/* Tools. The first screen is the table of six models seen from above, and each model is a button that opens
   its tool's card. Under it the same six sit in one table, then a sheet that says which three run this site.
   Built from the kit in site.css. What is here is what the kit lacks: a model you press instead of a mark,
   the table dimming around the chosen one, and the phone band you can drag along. */

/* ---------- the table of models ---------- */
/* The band keeps the picture's own shape, so the whole table shows and the left margin stays empty for the words. */
.tl-table { min-height: 0; aspect-ratio: 1672 / 941; }
.tl-table .k-band-over { padding-inline: var(--m); }
/* The kit gives a scene a shape of its own. Inside a band it has to take the band's. */
.tl-scene { aspect-ratio: auto; }
.tl-words { --gap: clamp(14px, 1.5vw, 24px); max-width: 23.6vw; transition: opacity 0.3s; }
.tl-h1 { font-size: clamp(27px, 2.9vw, 56px); font-weight: 500; line-height: 1; letter-spacing: -0.035em; text-wrap: balance; }
.tl-words .k-lede { font-size: clamp(15px, 1.1vw, 20px); }
.tl-rail { display: none; }

/* A model is a kit mark the size of the object. --cx and --cy are its middle and --bw and --bh its size, all in
   percent of the picture, written as plain numbers so the tile below can work out which part of the picture it is. */
.k-mark.tl-model { --x: calc(var(--cx) * 1%); --y: calc(var(--cy) * 1%); display: block; width: calc(var(--bw) * 1%); height: calc(var(--bh) * 1%); scale: 1; }
/* The tile is the same piece of the picture, laid exactly over it. It cannot be seen until it lifts. */
.tl-lift { position: absolute; inset: 0; opacity: 0; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(72, 52, 40, 0.1)) drop-shadow(0 14px 18px rgba(72, 52, 40, 0.2)); transition: opacity 0.2s, translate 0.4s var(--bounce); }
.tl-tile { --sq-r: 18px; display: block; width: 100%; height: 100%; background-color: var(--table); background-image: url(pic/p-kit.jpg); background-repeat: no-repeat;
  background-size: calc(10000% / var(--bw)) calc(10000% / var(--bh));
  background-position: calc((var(--cx) - var(--bw) / 2) / (100 - var(--bw)) * 100%) calc((var(--cy) - var(--bh) / 2) / (100 - var(--bh)) * 100%); }
/* The kit's ring sits inside a mark. Here the tile would cover it, so it goes just outside the model. */
.k-mark.tl-model:focus-visible { outline-offset: 2px; }
@media (hover: hover) { .tl-model:hover .tl-lift { opacity: 1; translate: 0 -6px; } }
/* The name tag under each model is always showing here, and pressing it presses the model. */
.k-mark.tl-model > b { --sq-r: 7px; top: 100%; padding: 6px 9px; font-size: 12px; opacity: 1; translate: -50% -8px; pointer-events: auto; transition: opacity 0.25s; }

/* A card is pinned: the table dims, the chosen model stays bright, and the name tags go, because the card says it. */
.tl-shade { position: absolute; inset: 0; background: rgba(245, 245, 247, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
body:has(.tl-card.is-pinned) .tl-shade { opacity: 1; }
body:has(.tl-card.is-pinned) .tl-model > b { opacity: 0; pointer-events: none; }
body:has(.tl-card.is-pinned) .tl-model[aria-expanded="true"] .tl-lift { opacity: 1; translate: 0 -6px; }
body:has(.tl-card.is-pinned) .tl-words { opacity: 0.35; }

/* The card. Until it is pinned it is the name, the maker and one sentence. */
.tl-card { width: min(384px, 86vw); }
.tl-shot { --sq-r: 10px; --ar: 16 / 9; }
.tl-card:not(.is-pinned) .tl-shot, html:not(.js) .tl-shot { display: none; }

@media (prefers-reduced-motion: no-preference) {
  /* Each model is set down in turn, then its tag. */
  .tl-lift { animation: tl-land 0.5s var(--bounce) backwards; animation-delay: calc(0.25s + var(--i, 0) * 80ms); }
  .k-mark.tl-model > b { animation: tl-tag 0.4s var(--out) backwards; animation-delay: calc(0.5s + var(--i, 0) * 80ms); }
}
@keyframes tl-land { from { opacity: 1; translate: 0 -12px; } 55% { opacity: 1; } to { opacity: 0; translate: 0 0; } }
@keyframes tl-tag { from { opacity: 0; translate: -50% -16px; } }

/* ---------- all six, in one table ---------- */
.tl-list { table-layout: fixed; margin-top: clamp(22px, 2.6vw, 40px); }
.tl-c-tool { width: 19%; }
.tl-c-by { width: 11%; }
.tl-c-status { width: 17%; }
.tl-c-where { width: 13%; }
.tl-list tbody tr { scroll-margin-top: 110px; }
.tl-list tbody tr:target { background: var(--raise); }
/* The name is the button that opens the row. */
.tl-name { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: clamp(20px, 1.5vw, 26px); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); }
.tl-name::after { content: '+'; content: '+' / ''; font: 400 15px/1 var(--mono); color: var(--label); }
.tl-name[aria-expanded="true"]::after { content: '\2212'; content: '\2212' / ''; }
html:not(.js) .tl-name { cursor: text; }
html:not(.js) .tl-name::after { content: none; }
.tl-more { display: grid; gap: 14px; max-width: 44em; margin-top: 12px; }
.tl-more .tl-shot { --ar: 16 / 7; max-width: 30em; }
.tl-list thead [data-sort] { padding-block: 6px; margin-block: -6px; }
/* A column that can be sorted says so. Once sorted, the kit draws which way. */
.tl-list thead th:not([aria-sort]) [data-sort]::after { content: ' \2195'; content: ' \2195' / ''; color: var(--dim); }
html:not(.js) .tl-list thead [data-sort] { cursor: text; }
html:not(.js) .tl-list thead [data-sort]::after { content: none; }
.tl-list a { display: inline-block; padding-block: 6px; margin-block: -6px; color: var(--ink); white-space: nowrap; }
.tl-none { color: var(--dim); }
.tl-note { margin-top: clamp(20px, 2.4vw, 36px); }

@media (min-width: 1000px) {
  /* Each cell's first line sits level with the name beside it. */
  .tl-list tbody td { padding-top: 23px; padding-bottom: 20px; }
  .tl-list tbody td.is-mono { padding-top: 26px; }
}

/* ---------- a gap like yours ---------- */
.tl-live { justify-self: end; width: min(100%, 34em); }
/* A row of the sheet is a link to that tool's row in the table. */
.tl-live .k-doc-rows > li { display: block; padding: 0; }
.tl-live .k-doc-rows a { display: grid; grid-template-columns: 1.4em 8.4em minmax(0, 1fr); column-gap: 13px; align-items: baseline; min-height: 44px; padding: 12px 0; color: inherit; text-decoration: none; transition: background-color 0.2s; }
.tl-live .k-doc-rows a:hover { background: var(--paper); margin-inline: -8px; padding-inline: 8px; }
.tl-live .k-doc-rows .k-chip { align-self: center; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* Rows rise as they come into view, one after the other because each comes in after the last. */
    .tl-list tbody tr { animation: tl-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
    /* The sheet slides up like a card, and its three squares pulse once each, since they mark what is live now. */
    .tl-live { view-timeline: --tl-live block; animation: tl-sheet linear both; animation-timeline: --tl-live; animation-range: entry 0% entry 90%; }
    .tl-live .k-chip { animation: tl-pulse linear both; animation-timeline: --tl-live; animation-range: cover calc(22% + var(--i, 0) * 5%) cover calc(34% + var(--i, 0) * 5%); }
  }
}
/* These move and never fade, so a row that has not been scrolled to yet is still there to read, print or capture. */
@keyframes tl-rise { from { translate: 0 18px; } }
@keyframes tl-sheet { from { translate: 0 48px; } }
@keyframes tl-pulse { 50% { scale: 1.9; } }

/* ---------- narrower ---------- */
/* Below 1000px, or on a screen taller than it is wide, the words no longer fit the picture's margin. The picture
   is a band with the whole table in it and the words sit under it on paper. */
@media (max-width: 999px), (max-aspect-ratio: 5/6) {
  .tl-table { display: flex; flex-direction: column; aspect-ratio: auto; background: var(--paper); }
  .tl-table .k-band-pic { position: relative; inset: auto; height: auto; aspect-ratio: 1672 / 941; }
  .tl-table .k-band-over { display: grid; grid-template: none; gap: 18px; padding: 22px var(--m) 36px; }
  .tl-table .k-band-over > * { grid-area: auto; place-self: auto; max-width: none; }
  .tl-words { --gap: 16px; }
  body:has(.tl-card.is-pinned) .tl-words { opacity: 1; }
  .tl-h1 { max-width: 16em; font-size: clamp(34px, 5.6vw, 54px); }
  .tl-words .k-lede { font-size: clamp(16px, 2.1vw, 19px); }
}

@media (min-width: 700px) and (max-width: 999px) {
  /* The table of six becomes rows that open. These are the kit's phone rules for a table, carried up to 999px,
     because five columns do not fit an upright tablet. Below 700px the kit applies them itself. */
  .tl-list, .tl-list tbody, .tl-list tr, .tl-list :is(th, td) { display: block; }
  .tl-list { width: 100%; margin-inline: 0; }
  .tl-list thead { display: none; }
  .tl-list tbody tr { padding: 14px 0; border-top: 1px solid var(--rule); }
  .tl-list tbody tr:last-child { border-bottom: 1px solid var(--rule); }
  .tl-list tbody tr:hover, .tl-list tbody tr:has([aria-expanded="true"]) { margin-inline: -12px; padding-inline: 12px; }
  .tl-list tbody :is(th, td), .tl-list tbody tr:last-child > * { padding-block: 0; padding-right: 0; border: 0; }
  .tl-list tbody th { padding-left: 0; }
  .tl-list td { position: relative; margin-top: 8px; }
  .tl-list td[data-label] { padding-left: 126px; }
  .tl-list td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 0; width: 114px; font: 500 12px/1.6 var(--mono); color: var(--label); }
}

@media (max-width: 999px) {
  .tl-list tbody tr:target { margin-inline: -12px; padding-inline: 12px; }
  /* What a row opens runs the full width of the row, under the label column too. */
  .tl-more { margin-left: -126px; }
  .tl-list a { white-space: normal; padding-block: 14px; margin-block: -14px; }
  .tl-live { justify-self: stretch; width: auto; }
}

/* A phone or an upright tablet. The band shows three models at a time, the tags give way to a row of chips in
   thumb reach, and the camera moves in on the chosen model, so nothing dims. */
@media (max-width: 699px), (max-aspect-ratio: 41/50) {
  .tl-table .k-band-pic { height: 46svh; aspect-ratio: auto; }
  .tl-scene { touch-action: pan-y; }
  .tl-shade, .tl-card .tl-shot { display: none; }
  /* Hidden, not removed, so the tiles do not land again when a window crosses this line. */
  .tl-lift { visibility: hidden; }
  .k-mark.tl-model > b { opacity: 0; pointer-events: none; }
  .tl-rail { display: flex; }
  html:not(.js) .tl-rail { display: none; }
}

@media (max-width: 699px) {
  .tl-live .k-doc-rows a { grid-template-columns: 1.4em minmax(0, 1fr); row-gap: 2px; }
  .tl-live .k-doc-rows a > span { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .tl-lift, .tl-shade, .tl-words { transition-duration: 0.01s; }
  .tl-model:hover .tl-lift, body:has(.tl-card.is-pinned) .tl-model[aria-expanded="true"] .tl-lift { translate: none; }
}
