/* =============================================================
   Tooltip Component — Paper Theme
   --------------------------------------------------------------
   The "?" trigger sits next to any input/output label. The
   popover floats above the calculator surface with a soft shadow
   and a clear close button. Range Mode overrides these rules
   under .body[data-mode="range"] for the glass aesthetic.
   ============================================================= */

/* ----- Trigger button (the "?" affordance) ----- */
.tt-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  vertical-align: middle;
  transition: color 0.14s, background-color 0.14s, transform 0.14s;
  flex-shrink: 0;
}
.tt-trigger:hover,
.tt-trigger:focus-visible {
  color: var(--orange-deep);
  background: var(--orange-tint);
  outline: none;
  transform: scale(1.08);
}
.tt-trigger[aria-expanded="true"] {
  color: var(--orange-deep);
  background: var(--orange-tint);
}
.tt-trigger svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ----- Popover ----- */
.tt-popover {
  position: absolute;
  z-index: 1000;
  width: min(360px, calc(100vw - 24px));
  background: white;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5) var(--s-4) var(--s-4);
  box-shadow:
    0 1px 2px rgba(45,54,61,0.08),
    0 8px 32px -8px rgba(45,54,61,0.24);
  font-family: var(--body);
  color: var(--charcoal);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.14s var(--ease-out), transform 0.14s var(--ease-out);
  pointer-events: none;
}
.tt-popover--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.tt-popover--above {
  /* When flipped above the trigger, animate up from below */
  transform: translateY(4px);
}
.tt-popover--above.tt-popover--open {
  transform: translateY(0);
}

.tt-popover__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.14s, color 0.14s;
}
.tt-popover__close:hover,
.tt-popover__close:focus-visible {
  background: var(--paper-warm);
  color: var(--charcoal);
  outline: none;
}
.tt-popover__close svg {
  width: 14px;
  height: 14px;
}

.tt-popover__title {
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.25;
  margin-right: 28px; /* clear the close button */
  color: var(--charcoal);
}
.tt-popover__short {
  margin-top: 6px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--charcoal-3);
  line-height: 1.45;
}
.tt-popover__long {
  margin-top: var(--s-3);
  font-size: var(--t-sm);
  color: var(--charcoal-3);
  line-height: 1.6;
}
.tt-popover__long:empty {
  display: none;
}
