/* A tool as an item: the card and the shelf, shared by the three homepages'
   toolboxes, /tools/ and every tool's own page (tools/shelf.js draws them).

   The card is a Marketplace item's (blueprints.css `.card`): the picture is
   the card, the words sit under it on the page's own paper with no box round
   them, so a row reads as a wall of pictures. What a tool adds is its face:
   the app's own icon tile, glyph over the shared background as the app and
   the help site draw it, lifted onto the picture's lower corner, and the
   plan chip in the colour the pricing cards wear for that plan.

   Every colour is the page's token (--paper, --ink, --muted, --line,
   --accent-text) or the plan's (--tc, --tt, from window.T6FV_TIERS), so the
   card sits on the homepage, on a dark band and on /tools/ without a rule of
   its own for each. */

.tcard { display: flex; flex-direction: column; min-width: 0; position: relative; color: var(--ink); text-decoration: none; }
.tcard .tc-pic {
  position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: visible;
}
.tcard .tc-pic > img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%);
  border-radius: 12px; background: #15171a;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}
/* A plan-coloured wash over the bottom of the picture, so the tile reads on
   any picture and the row carries the plan colours the old rail did. */
.tcard .tc-pic::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background: linear-gradient(to top, color-mix(in srgb, var(--tc) 34%, rgba(0, 0, 0, .55)) 0%, transparent 46%);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.tcard .tc-tile {
  position: absolute; left: 14px; bottom: -18px; z-index: 2;
  width: 54px; height: 54px; border-radius: 22%; overflow: hidden;
  background: #1d2326 url(/tools/img/tiles/background.webp) center / cover;
  box-shadow: 0 0 0 3px var(--paper), 0 6px 16px rgba(0, 0, 0, .28);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.tcard .tc-tile img { display: block; width: 100%; height: 100%; }
.tcard .tc-body { display: flex; flex-direction: column; gap: 5px; padding: 28px 2px 0; flex: 1; }
/* The tool's group, where a Marketplace card names its kind. */
.tcard .tc-kind { font: 800 10.5px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); }
.tcard h3 { font: 800 16.5px/1.25 var(--display); letter-spacing: -0.01em; margin: 0; }
.tcard p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tcard .tc-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 10px; }
.tcard .tc-chip {
  font: 800 10px/1 var(--display); letter-spacing: .08em;
  background: var(--tc); color: var(--tt); border-radius: 4px; padding: 4px 6px;
}
/* BETA, as the homepage's editors and the old rail wear it: an outline in
   the page's muted ink beside the plan, never a second plan colour. The
   word is the page's tx('Beta'), as the old rail's was, so a translated
   page says it in its own language. */
.tcard .tc-beta {
  font: 800 9.5px/1 var(--display); letter-spacing: .08em;
  color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 3px 5px;
  text-transform: uppercase;
}
.tcard .tc-go {
  margin-left: auto; font: 700 13.5px/1 var(--display); color: var(--accent-text); white-space: nowrap;
}
.tcard .tc-go::after { content: " \2192"; display: inline-block; transition: transform .2s ease; }
a.tcard:hover .tc-pic > img, a.tcard:focus-visible .tc-pic > img,
a.tcard:hover .tc-pic::after, a.tcard:focus-visible .tc-pic::after { transform: translateY(-4px); }
a.tcard:hover .tc-pic > img, a.tcard:focus-visible .tc-pic > img {
  box-shadow: 0 0 0 1px var(--tc), 0 14px 34px color-mix(in srgb, var(--tc) 32%, rgba(0, 0, 0, .25));
}
a.tcard:hover .tc-tile, a.tcard:focus-visible .tc-tile { transform: translateY(-4px); }
a.tcard:hover .tc-go::after { transform: translateX(3px); }
a.tcard:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
a.tcard:focus-visible { outline: none; }
a.tcard:focus-visible .tc-pic { outline: 2px solid var(--accent-text); outline-offset: 4px; }
/* A page that does not talk about plans (/corporate/) draws the card
   without its chip; the plan's colour stays in the wash. */
.tcard.plain .tc-foot { display: none; }

/* ---- the shelf ----------------------------------------------------------
   Four to a view on a desk, two and a peek on a phone; snaps card by card,
   arrows on its shoulders, drag with a mouse. shelf.js moves it on by one
   card every few seconds while it is on screen and nobody is touching it,
   and never under reduced motion. A box that scrolls sideways clips up and
   down too, so the rail is padded by what the hover lift, the glow and the
   tile need and gives it back with a negative margin. */
.tshelf { position: relative; }
.tshelf .ts-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 60px) / 4); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; overscroll-behavior-x: contain;
  margin: -18px -22px -30px; padding: 18px 22px 34px; scroll-padding: 0 22px;
  list-style: none; cursor: grab;
}
.tshelf .ts-rail::-webkit-scrollbar { display: none; }
.tshelf .ts-rail > li { scroll-snap-align: start; display: flex; }
.tshelf .ts-rail > li > .tcard { flex: 1; }
.tshelf .ts-rail.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.tshelf .ts-rail.dragging a, .tshelf .ts-rail.dragging img { pointer-events: none; }
.tshelf .ts-edge {
  position: absolute; top: var(--mid, 36%); z-index: 6; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 6px 20px rgba(0, 0, 0, .22);
}
.tshelf .ts-edge[hidden] { display: none; }
.tshelf .ts-edge svg { width: 18px; height: 18px; }
.tshelf .ts-edge:hover { background: var(--ink); color: var(--paper); }
.tshelf .ts-edge:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.tshelf .ts-edge.back { left: -23px; }
.tshelf .ts-edge.on { right: -23px; }
/* Under a shelf, where the row is in the whole list: a bar the width of
   what is in view, sliding along a track as the row goes round. */
.tshelf .ts-bar { position: relative; height: 3px; margin: 18px auto 0; max-width: 320px; border-radius: 99px; background: var(--line); overflow: hidden; }
.tshelf .ts-bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--accent-text); transition: left .45s ease, width .3s ease; }
/* All of it in view: nothing to move, nothing to say where. */
.tshelf.ts-few .ts-edge, .tshelf.ts-few .ts-bar { display: none; }
@media (max-width: 960px) {
  .tshelf .ts-rail { grid-auto-columns: calc((100% - 40px) / 3); }
}
@media (max-width: 720px) {
  .tshelf .ts-rail { grid-auto-columns: 44%; gap: 16px; }
  .tshelf .ts-edge { display: none; }
}
@media (max-width: 460px) {
  .tshelf .ts-rail { grid-auto-columns: 72%; }
}

/* ---- the grid on /tools/ ------------------------------------------------
   Four to a row, three beside the filters, as the Marketplace's results. */
.tgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 20px; list-style: none; margin: 0; padding: 0; }
.fshow .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tgrid > li { display: flex; scroll-margin: 140px; }
.tgrid > li > .tcard { flex: 1; }
.tgrid > li[hidden] { display: none; }
/* Opened from a shelf at this card: it glows once in its plan's colour. */
.tgrid > li.is-flash .tc-pic > img { animation: tc-flash 1.8s ease-out; }
@keyframes tc-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--tc), 0 0 40px color-mix(in srgb, var(--tc) 50%, transparent); } }
@media (max-width: 1100px) { .tgrid, .fshow .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tgrid, .fshow .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; } }

@media (prefers-reduced-motion: reduce) {
  .tcard .tc-pic > img, .tcard .tc-pic::after, .tcard .tc-tile, .tcard .tc-go::after { transition: none; }
  .tshelf .ts-bar i { transition: none; }
  .tgrid > li.is-flash .tc-pic > img { animation: none; }
  .tshelf .ts-rail { scroll-behavior: auto; }
}
