/* Info tip: the small "i" that explains a term (InfoTipHelper#info_tip), and its panel.
 *
 * Registered in BOTH asset bundles, the same way estimate_disclaimer.css is:
 *   - app/assets/tailwind/application.css  @import ... layer(components)
 *   - app/views/layouts/onboarding.html.erb  stylesheet_link_tag
 *
 * 🚨 The onboarding layout (the enrollment steps' full page among others) has no Tailwind,
 * so without this sheet it had no `.tooltip { display: none }` either: the W-9 tip's panel
 * stood open on the payout step, over the Continue button. That is why the panel's whole
 * recipe lives here, self-contained, and not only its info-tip extras. Plain CSS (no
 * nesting, no @apply), tokens with fallbacks so either bundle's root can feed it.
 *
 * A real button driving the shared tooltip controller. Sits inline after the term, in a
 * heading, a label or a sentence, so it sizes to 16px and leaves the line height alone.
 * Hover deepens the icon colour, no fill (CLAUDE.md: no hover fills). The ::after widens
 * the tap target to 32px without moving the text around it. */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin-inline-start: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--base-text-tertiary, #8a948f);
  vertical-align: -0.15em;
  cursor: pointer;
}
.info-tip::after {
  content: "";
  position: absolute;
  inset: -8px;
}
.info-tip:hover,
.info-tip.is-tooltip-pinned {
  color: var(--base-text-secondary, #4b5563);
}
.info-tip:focus-visible {
  outline: 2px solid var(--base-border-focus, #0ea184);
  outline-offset: 1px;
}
.info-tip__icon {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* The panel. Paragraph copy rather than a label gloss, so it wraps at a reading width, and
   never wider than a phone. Blank lines in the copy are paragraph breaks (pre-line). It only
   explains a term, so it never catches a click meant for whatever it overlaps. */
.tooltip.info-tip-pop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 4px;
  background-color: var(--base-bg-tooltip, #1f2937);
  color: var(--base-text-on-tooltip, #ffffff);
  box-shadow: 0 4px 6px -1px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.10);
  font: var(--type-secondary, 400 0.8125rem/1.25rem) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  text-align: left;
  white-space: pre-line;
  pointer-events: none;
}
.tooltip.info-tip-pop.open {
  display: block;
}
.tooltip.info-tip-pop .arrow {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--base-bg-tooltip, #1f2937);
  transform: rotate(45deg);
  z-index: -1;
  pointer-events: none;
}

/* Card variant (info_tip variant: :card; first caller: shared/deck/_help, the swipe deck's help).
   A light card under the (i) rather than the dark pill, styled after the deal board's column
   help (.ws-stage-pop) but its own classes, so buyer and broker stay apart. Content uses the
   role-neutral .help-card__* classes below.

   The panel is a child of <body>, outside .buying-shell, so --buying-accent* never reach it. The
   mint here is the global brand ramp (--ph-brand-*, themed in light.css and dark.css), the same
   values the buyer shell's accents hold: text #0A6E5C, tint #E7F7F1, mark #0EA184.

   🚨 No inner scroll. The tooltip controller unpins on any scroll, so a card that scrolled would
   close under the finger: it has to fit a phone whole (measured under 360px tall at 390). */
.info-tip.info-tip--card {
  width: 24px;
  height: 24px;
}
/* 44px to tap, on any pointer. */
.info-tip.info-tip--card::after {
  inset: -10px;
}
.info-tip--card .info-tip__icon {
  width: 17px;
  height: 17px;
}
.info-tip.info-tip--card.is-tooltip-pinned {
  background: var(--ph-brand-tint, #e7f7f1);
  color: var(--ph-brand-text, #0a6e5c);
}

.tooltip.info-tip-pop.info-tip-pop--card {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 16px 20px;
  border-radius: 16px;
  background-color: var(--base-bg-low, #ffffff);
  color: var(--base-text, #222222);
  box-shadow: var(--ws-shadow-menu, 0 12px 40px rgba(0, 0, 0, 0.16));
  font: var(--type-body, 400 0.8125rem/1.5) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  white-space: normal;
}
/* Readable and hoverable: the pointer can travel into it, and text in it can be selected. */
.tooltip.info-tip-pop.info-tip-pop--card.open {
  pointer-events: auto;
}
.tooltip.info-tip-pop.info-tip-pop--card .arrow {
  background-color: var(--base-bg-low, #ffffff);
}
@media (min-width: 1024px) {
  .tooltip.info-tip-pop.info-tip-pop--card {
    width: 384px;
  }
}

.help-card__head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.help-card__dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ph-brand-mark, #0ea184);
}
.help-card__title {
  margin: 0;
  font: var(--type-callout, 400 0.875rem/1.5) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  font-weight: var(--fw-semibold, 600);
  color: var(--base-text, #222222);
}
/* 13px, a step under the title, so the lede holds one line on a 390 phone. */
.help-card__lede {
  margin: 6px 0 0;
  font: var(--type-body, 400 0.8125rem/1.5) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  color: var(--base-text, #222222);
}
.help-card__label {
  margin: 14px 0 8px;
  font: var(--type-overline, 600 0.6875rem/1.25) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  font-weight: var(--fw-medium, 500);
  letter-spacing: var(--tk-eyebrow, 0.12em);
  text-transform: uppercase;
  color: var(--base-text-tertiary, #737373);
}

/* The gesture strip: Pass, an arrow, the card, an arrow, Interested. Each arrow has its own lane
   and sits level with the answer marks, not the names. */
.help-card__gesture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 76px 30px minmax(0, 1fr);
  align-items: center;
  height: 78px;
  padding: 0 6px;
  border: 1px solid var(--base-border-tertiary, #e8e6e1);
  border-radius: 12px;
  background: var(--base-bg-subtle, #f9fafb);
}
.help-card__answer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.help-card__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--base-border-tertiary, #e8e6e1);
  border-radius: 999px;
  background: var(--base-bg-low, #ffffff);
  color: var(--base-text-secondary, #404040);
}
.help-card__answer.is-yes .help-card__mark {
  border-color: transparent;
  background: var(--ph-brand-tint, #e7f7f1);
  color: var(--ph-brand-text, #0a6e5c);
}
.help-card__glyph {
  width: 15px;
  height: 15px;
}
.help-card__name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: var(--type-label, 500 0.75rem/1.25) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  font-weight: var(--fw-semibold, 600);
  color: var(--base-text, #222222);
  white-space: nowrap;
}
.help-card__answer.is-yes .help-card__name {
  color: var(--ph-brand-text, #0a6e5c);
}
.help-card__arrow {
  width: 30px;
  height: 15px;
  margin-top: -18px;
  color: var(--ph-brand-mark, #0ea184);
}
.help-card__arrow--left {
  color: var(--base-text-quaternary, #a3a3a3);
  transform: scaleX(-1);
}

/* The card silhouette: a small card (cover band, two text lines) over two tilted outlines, the
   places it goes. Outlines only, so the card stays the subject. */
.help-card__stack {
  position: relative;
  height: 78px;
}
.help-card__stack > span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 54px;
  margin: -27px 0 0 -20px;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px var(--base-border-secondary, #d4d4d4);
}
.help-card__stack > span:nth-child(1) {
  transform: translateX(-12px) rotate(-14deg);
}
.help-card__stack > span:nth-child(2) {
  transform: translateX(12px) rotate(14deg);
}
.help-card__stack > span:nth-child(3) {
  overflow: hidden;
  background: var(--base-bg-low, #ffffff);
  box-shadow: 0 0 0 1px var(--base-border-tertiary, #e8e6e1), 0 3px 8px rgba(0, 0, 0, 0.10);
}
.help-card__stack > span:nth-child(3)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 23px;
  background: linear-gradient(135deg, var(--ph-brand-tint, #e7f7f1), var(--ph-brand-tint-strong, #c4ebdf));
}
.help-card__stack > span:nth-child(3)::after {
  content: "";
  position: absolute;
  top: 30px;
  left: 6px;
  right: 11px;
  height: 4px;
  border-radius: 2px;
  background: var(--base-border-secondary, #d4d4d4);
  box-shadow: 0 8px 0 var(--base-border-tertiary, #e8e6e1);
}

/* Compact rows: an icon, a bold word, a short grey line, and its key from 1024. */
.help-card__rows {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.help-card__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.help-card__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--status-neutral-bg, #f5f5f5);
  color: var(--base-text-secondary, #404040);
}
.help-card__icon .help-card__glyph {
  width: 14px;
  height: 14px;
}
.help-card__text {
  min-width: 0;
  color: var(--base-text-secondary, #404040);
}
.help-card__text b {
  font-weight: var(--fw-semibold, 600);
  color: var(--base-text, #222222);
}
.help-card__keys {
  gap: 4px;
  margin-left: auto;
}

/* Keys and the mouse words show from 1024, where there is a keyboard; the touch words below it. */
.help-card__key,
.help-card__keys,
.help-card__mouse {
  display: none;
}
@media (min-width: 1024px) {
  .help-card__touch {
    display: none;
  }
  .help-card__mouse {
    display: inline;
  }
  .help-card__keys {
    display: flex;
  }
  .help-card__key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--base-border-tertiary, #e8e6e1);
    border-radius: 6px;
    background: var(--status-neutral-bg, #f5f5f5);
    color: var(--base-text-secondary, #404040);
    font: var(--type-caption, 400 0.6875rem/1.35) var(--font-sans, ui-sans-serif, system-ui, sans-serif);
    font-weight: var(--fw-medium, 500);
  }
}

/* The narrowest phones (320): slimmer arrow lanes, so "Interested" keeps its column. */
@media (max-width: 359px) {
  .help-card__gesture {
    grid-template-columns: minmax(0, 1fr) 18px 64px 18px minmax(0, 1fr);
  }
  .help-card__arrow {
    width: 18px;
  }
}
