/* Help popup (help.js). Uses the page's tokens on :root; everything is
   prefixed sp-help- so it can move to another page with the two files.
   Desktop: a 400px panel above a bottom-right Help button. Phones and short
   screens (under 600px wide or 560px tall): full screen. Teal header in the
   darker teal: white small text on the brighter page teal fails contrast. */

.sp-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.sp-help-launch { position: fixed; z-index: 55; right: max(24px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; background: var(--ink); color: var(--canvas); font-family: var(--font); font-size: 15px; font-weight: 600; line-height: 1; box-shadow: 0 10px 30px rgba(26, 26, 26, 0.25); cursor: pointer; transition: background-color 0.15s ease; -webkit-tap-highlight-color: transparent; }
.sp-help-launch:hover { background: #333333; }
.sp-help-launch:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.sp-help-launch svg { width: 22px; height: 22px; flex: none; }
.sp-help-launch .sp-help-i-close { display: none; }
.sp-help-launch[aria-expanded="true"] { width: 56px; height: 56px; padding: 0; }
.sp-help-launch[aria-expanded="true"] .sp-help-i-open,
.sp-help-launch[aria-expanded="true"] .sp-help-launch-label { display: none; }
.sp-help-launch[aria-expanded="true"] .sp-help-i-close { display: block; }

.sp-help { position: fixed; z-index: 60; right: max(24px, env(safe-area-inset-right, 0px)); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 72px); width: 400px; height: min(640px, calc(100vh - 128px)); height: min(640px, calc(100dvh - 128px)); display: flex; flex-direction: column; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; border: 1px solid rgba(26, 26, 26, 0.10); border-radius: 24px; box-shadow: 0 24px 60px rgba(26, 26, 26, 0.18), 0 2px 8px rgba(26, 26, 26, 0.06); overflow: hidden; opacity: 0; transform: translateY(12px) scale(0.98); transform-origin: 100% 100%; transition: opacity 0.18s ease, transform 0.18s ease; -webkit-font-smoothing: antialiased; }
.sp-help[hidden] { display: none; }
.sp-help.is-open { opacity: 1; transform: none; }
.sp-help *, .sp-help *::before, .sp-help *::after { box-sizing: border-box; }
.sp-help [hidden] { display: none !important; }
.sp-help :focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sp-help h2:focus, .sp-help h2:focus-visible { outline: none; }

/* Header: teal on home and while searching */
.sp-help-top { flex: none; background: var(--teal-deep); color: #FFFFFF; padding: 18px 16px 20px 24px; }
.sp-help-top :focus-visible { outline-color: #FFFFFF; }
.sp-help-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sp-help-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.sp-help-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-teal-soft); }
.sp-help-sub { margin: 2px 0 0; font-size: 14px; color: var(--on-teal-soft); }
.sp-help-x { width: 44px; height: 44px; flex: none; border-radius: 999px; border: 0; background: rgba(255, 255, 255, 0.14); color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.15s ease; }
.sp-help-x:hover { background: rgba(255, 255, 255, 0.24); }
.sp-help-x svg { width: 20px; height: 20px; }
.sp-help-search { position: relative; margin: 14px 8px 0 0; }
.sp-help-search > svg { position: absolute; left: 18px; top: 16px; width: 20px; height: 20px; color: var(--mute); pointer-events: none; }
.sp-help-search input { display: block; width: 100%; height: 52px; margin: 0; border: 0; border-radius: 999px; padding: 0 52px 0 48px; background: #FFFFFF; color: var(--ink); font-family: inherit; font-size: 16px; font-weight: 500; -webkit-appearance: none; appearance: none; }
.sp-help-search input::placeholder { color: var(--mute); opacity: 1; }
.sp-help-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.sp-help-search input:focus { outline: 3px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
.sp-help-clear { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--mute); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sp-help-clear:hover { color: var(--ink); }
.sp-help-clear svg { width: 18px; height: 18px; }
.sp-help-search .sp-help-clear:focus-visible { outline-color: var(--teal); outline-offset: -3px; }
.sp-help[data-view="search"] .sp-help-title,
.sp-help[data-view="search"] .sp-help-sub,
.sp-help:not([data-view="search"]) .sp-help-eyebrow { display: none; }
.sp-help[data-view="search"] .sp-help-top { padding-top: 12px; padding-bottom: 18px; }
.sp-help[data-view="search"] .sp-help-search { margin-top: 6px; }

/* Bar: white, with Back, on a topic or an answer */
.sp-help-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 8px 12px; border-bottom: 1px solid rgba(26, 26, 26, 0.10); }
.sp-help-back { min-height: 44px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; background: transparent; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
.sp-help-back:hover { background: var(--paper); }
.sp-help-back svg { width: 20px; height: 20px; }
.sp-help-bar .sp-help-x { background: var(--paper); color: var(--ink); }
.sp-help-bar .sp-help-x:hover { background: #E9E9EB; }

/* Body */
.sp-help-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 16px; }
.sp-help-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal-deep); }
.sp-help-label-gap { margin-top: 24px; margin-bottom: 10px; }
.sp-help-h { margin: 0 0 6px; font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; }
.sp-help-list { list-style: none; margin: 0; padding: 0; }
.sp-help-list li + li { border-top: 1px solid rgba(26, 26, 26, 0.10); }
.sp-help-q { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; margin: 0; background: none; border: 0; text-align: left; font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--ink); cursor: pointer; }
.sp-help-q:hover > span { color: var(--teal-deep); }
.sp-help-q svg { width: 18px; height: 18px; flex: none; color: var(--mute); }
.sp-help-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-help-chip { min-height: 40px; padding: 0 14px; margin: 0; border-radius: 999px; border: 0; background: var(--paper); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; transition: background-color 0.15s ease; }
.sp-help-chip:hover { background: var(--teal-tint); }
.sp-help-loading { margin: 0; color: var(--mute); font-size: 14px; }

/* Results */
.sp-help[data-view="search"] .sp-help-body { padding: 16px 12px 12px; }
.sp-help[data-view="search"] .sp-help-body > .sp-help-label,
.sp-help[data-view="search"] .sp-help-body > .sp-help-list,
.sp-help[data-view="search"] .sp-help-body > .sp-help-chips,
.sp-help[data-view="search"] .sp-help-body > .sp-help-none { margin-inline: 12px; }
.sp-help-count { margin: 0 12px 8px; font-size: 13px; color: var(--mute); }
.sp-help-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-help-result { border-radius: 14px; padding: 12px; cursor: pointer; }
.sp-help-result:hover { background: var(--paper); }
.sp-help-result[aria-selected="true"] { background: var(--teal-tint); }
.sp-help-result-q { font-size: 15px; font-weight: 500; line-height: 1.4; }
.sp-help-result-q mark { background: none; color: var(--teal-deep); font-weight: 600; }
.sp-help-result-a { margin-top: 4px; font-size: 13.5px; line-height: 1.5; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-help-result-t { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--teal-deep); }
.sp-help-none { padding-top: 6px; }
.sp-help-none h3 { margin: 0; font-size: 18px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.sp-help-none p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--mute); }
.sp-help-ask { margin-top: 16px; border: 0; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-size: 15px; font-weight: 600; text-decoration: none; }
.sp-help-ask:hover { background: #333333; }
.sp-help-ask svg, .sp-help-link svg { width: 16px; height: 16px; flex: none; }

/* An answer */
.sp-help-answer p:not(.sp-help-label) { margin: 12px 0 0; font-size: 15px; line-height: 1.6; }
.sp-help-answer ul, .sp-help-answer ol { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; }
.sp-help-answer ol { counter-reset: sp-help-step; }
.sp-help-answer ol li { display: flex; gap: 12px; align-items: flex-start; counter-increment: sp-help-step; }
.sp-help-answer ol li::before { content: counter(sp-help-step); flex: none; width: 26px; height: 26px; margin-top: -1px; border-radius: 999px; background: var(--teal-tint); color: var(--teal-deep); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.sp-help-answer ul li { position: relative; padding-left: 20px; }
.sp-help-answer ul li::before { content: ""; position: absolute; left: 4px; top: 0.62em; width: 7px; height: 7px; border-radius: 999px; background: var(--teal); }
.sp-help-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sp-help-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; margin: 0; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.sp-help-link:hover { background: var(--paper); }

/* Sending us a message */
.sp-help-lead { margin: 4px 0 0; font-size: 15px; color: var(--mute); }
.sp-help-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.sp-help-field { display: flex; flex-direction: column; gap: 6px; }
.sp-help-field label { font-size: 14px; font-weight: 600; }
.sp-help-opt { font-weight: 400; color: var(--mute); }
.sp-help-field input, .sp-help-field textarea { width: 100%; margin: 0; border: 1.5px solid rgba(26, 26, 26, 0.22); border-radius: 12px; background: var(--canvas); color: var(--ink); font-family: inherit; font-size: 16px; line-height: 1.5; -webkit-appearance: none; appearance: none; }
.sp-help-field input { height: 48px; padding: 0 14px; }
.sp-help-field textarea { min-height: 128px; padding: 12px 14px; resize: vertical; }
.sp-help-field input:focus, .sp-help-field textarea:focus { border-color: var(--teal-deep); outline: 3px solid var(--teal-tint); outline-offset: 0; }
.sp-help-field [aria-invalid="true"], .sp-help-field [aria-invalid="true"]:focus { border-color: #B3261E; }
.sp-help-field [aria-invalid="true"]:focus { outline-color: #FCEEEE; }
.sp-help-err { margin: 0; font-size: 13px; line-height: 1.4; color: #B3261E; }
.sp-help-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sp-help-note { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--mute); overflow-wrap: anywhere; }
.sp-help-formerr { padding: 12px 14px; border-radius: 12px; background: #FCEEEE; color: #8C1D18; font-size: 14px; line-height: 1.5; }
.sp-help-formerr a { color: inherit; font-weight: 600; }
.sp-help-send { min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ink); color: #FFFFFF; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.sp-help-send:hover { background: #333333; }
.sp-help-send:disabled { background: #5C5C5C; cursor: progress; }
.sp-help-privacy { margin: 0; font-size: 12.5px; color: var(--mute); }
.sp-help-privacy a { color: var(--teal-deep); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.sp-help-privacy a:hover { text-decoration: underline; }
.sp-help-privacy a svg { width: 13px; height: 13px; }
.sp-help-sent { padding-top: 12px; }
.sp-help-tick { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 16px; border-radius: 999px; background: var(--teal-tint); color: var(--teal-deep); }
.sp-help-tick svg { width: 26px; height: 26px; }
.sp-help-sent p { margin: 4px 0 18px; font-size: 15px; color: var(--mute); overflow-wrap: anywhere; }

/* Footer */
.sp-help-foot { flex: none; border-top: 1px solid rgba(26, 26, 26, 0.10); padding: 6px 16px 6px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--mute); }
.sp-help-foot-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 0; border: 0; background: none; color: var(--teal-deep); font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.sp-help-foot-link:hover { text-decoration: underline; }
.sp-help-keys { display: none; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.sp-help-keys kbd { font-family: inherit; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(26, 26, 26, 0.18); color: var(--ink); }
.sp-help-keys kbd:nth-of-type(3) { margin-left: 6px; }
@media (hover: hover) and (pointer: fine) {
  .sp-help[data-view="search"] .sp-help-keys { display: inline-flex; }
  .sp-help[data-view="search"] .sp-help-foot-text { display: none; }
}

/* Phones and short screens: full screen */
html.sp-help-full { overflow: hidden; }
@media (max-width: 599px), (max-height: 560px) {
  .sp-help-launch { right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  html.sp-help-full .sp-help-launch { visibility: hidden; }
  .sp-help { top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; transform: translateY(24px); transform-origin: 50% 100%; }
  .sp-help-top { padding: max(16px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); }
  .sp-help[data-view="search"] .sp-help-top { padding-top: max(10px, env(safe-area-inset-top, 0px)); }
  .sp-help-search { margin-right: 4px; }
  .sp-help-bar { padding: max(8px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px)); }
  .sp-help-body { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .sp-help[data-view="search"] .sp-help-body { padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(4px, env(safe-area-inset-right, 0px)); }
  .sp-help-foot { padding: 6px max(16px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-help, .sp-help-launch, .sp-help-x, .sp-help-chip { transition: none; }
  .sp-help, .sp-help.is-open { transform: none; }
}
@media print {
  .sp-help-launch, .sp-help { display: none !important; }
}
