/* Tool and term cards (owner approved, 2026-11-24; scripts/tool_cards.py and
   javascripts/tool-cards.js). One floating card, filled from the hidden
   card the build wrote for the link under the pointer or in focus. Neutral
   colors: the status tag reuses the directory's own (.tool-status, from
   layout-tools.css, which the layer reaches by carrying .md-typeset). */

.hub-cards[hidden] {
  display: none;
}

.md-typeset.hub-card-layer {
  position: absolute;
  /* Above the corner Navigate control (layout-nav.css, up to 7) while open. */
  z-index: 8;
  box-sizing: border-box;
  width: min(22rem, calc(100vw - 1rem));
  margin: 0;
  padding: .65rem .8rem .6rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: .3rem;
  background-color: var(--md-default-bg-color);
  box-shadow: var(--md-shadow-z2);
  color: var(--md-default-fg-color);
  font-size: .68rem;
  line-height: 1.5;
}

.md-typeset.hub-card-layer[hidden] {
  display: none;
}

.md-typeset.hub-card-layer p {
  margin: 0 0 .4rem;
}

.md-typeset.hub-card-layer .hub-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .15rem;
}

.md-typeset.hub-card-layer .hub-card__name {
  font-size: .76rem;
  font-weight: 700;
}

.md-typeset.hub-card-layer .tool-status,
.md-typeset.hub-card-layer .hub-card__kind {
  flex: none;
  font-size: .6rem;
}

.md-typeset.hub-card-layer .hub-card__kind {
  color: var(--md-default-fg-color--light);
  font-weight: 600;
}

.md-typeset.hub-card-layer .hub-card__sub {
  color: var(--md-default-fg-color--light);
  font-size: .62rem;
}

.md-typeset.hub-card-layer .hub-card__cost::before {
  content: " \00B7  ";
}

.md-typeset.hub-card-layer .hub-card__limits strong {
  font-weight: 650;
}

.md-typeset.hub-card-layer .hub-card__note {
  color: var(--md-default-fg-color--light);
}

/* The buttons: where the link goes ("Visit site", "Read the guide"), then
   the full entry. Drawn like the directory's Visit site (layout-tools.css,
   a.tool-visit); the arrow marks only a link that leaves the Hub. */
.md-typeset.hub-card-layer .hub-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .5rem 0 0;
  padding-top: .45rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.md-typeset.hub-card-layer .hub-card__actions a {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  min-height: 1.5rem;
  padding: .1rem .55rem;
  border: 1px solid var(--hub-row-rule);
  border-radius: .3rem;
  background: var(--md-default-bg-color);
  color: var(--md-typeset-a-color);
  font-size: .64rem;
  font-weight: 600;
  text-decoration: none;
}

.md-typeset.hub-card-layer .hub-card__actions a[hidden] {
  display: none;
}

.md-typeset.hub-card-layer .hub-card__actions a:hover {
  border-color: var(--md-typeset-a-color);
  background: var(--hub-quiet-bg);
}

.md-typeset.hub-card-layer .hub-card__go[data-dest="site"]::after {
  content: "\2197";
  content: "\2197" / "";
  font-size: .85em;
  font-weight: 400;
}

/* Phones: a sheet along the bottom of the screen rather than a card beside
   the word, so it never lands on the header or runs off the edge; a long
   card scrolls inside itself. javascripts/tool-cards.js uses the same width. */
@media screen and (max-width: 599.98px) {
  .md-typeset.hub-card-layer {
    position: fixed;
    top: auto !important;
    right: .5rem;
    bottom: .5rem;
    left: .5rem !important;
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: var(--md-shadow-z3);
  }

  /* Buttons big enough for a thumb: at least 44 by 44 CSS pixels. */
  .md-typeset.hub-card-layer .hub-card__actions a {
    min-height: 2.2rem;
    padding: .3rem .75rem;
    font-size: .72rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .md-typeset.hub-card-layer:not([hidden]) {
    animation: hub-card-in .12s ease-out;
  }

  @keyframes hub-card-in {
    from {
      opacity: 0;
      transform: translateY(-2px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }
}
