/* "all things engineering" opens a story card: hover on desktop, tap (focus) on phones */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  text-decoration: underline dotted 2px var(--gold);
  text-underline-offset: 0.2em;
  outline: none;
}
.tooltip:hover, .tooltip:focus { color: var(--gold); }

.tooltip .story {
  position: absolute;
  left: 0;
  bottom: calc(100% + 14px); /* hero text sits low, so the card opens upward */
  z-index: 3;
  display: block;
  width: min(420px, 85vw);
  padding: 1.1rem 1.3rem;
  border-radius: 14px;
  border: 1px solid rgba(234, 189, 107, 0.45);
  background: rgba(14, 24, 16, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  text-shadow: none;
  cursor: default;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}
.tooltip:hover .story, .tooltip:focus .story,
.tooltip:focus-within .story { visibility: visible; opacity: 1; transform: none; }

.story-row {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s, transform 0.4s;
}
.story-row + .story-row { margin-top: 0.75rem; }
.story-row b {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}
/* rows unfold one after another, like a story */
.tooltip:hover .story-row, .tooltip:focus .story-row { opacity: 1; transform: none; }
.tooltip .story-row:nth-child(2) { transition-delay: 0.15s; }
.tooltip .story-row:nth-child(3) { transition-delay: 0.3s; }

@media only screen and (max-width: 55em) {
  /* hero text sits at the top on phones, so open downward */
  .tooltip .story { bottom: auto; top: calc(100% + 10px); left: -1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tooltip .story, .story-row { transition: none; transform: none; }
}
