/* A package's page, /package/<name>/ (scripts/modules-page.mjs): npm's view of a package and more, in the site's own
 * make (the owner, 20 Nov: "we provide an upgrade over npm view for package specific ecosystem"; "/modules/xxx pages
 * which have different style from the main modules page. That is severe inconsistency"). The sheet, a part's head and
 * the scale are the home's (home/index.css, bar.css); this is what a dossier has of its own: its head's name and
 * install, its contents in the page's first column, its facts, its Listen, its README set to be read. A first hand */

/* its head, a part's band: the name over the first two columns (a scoped name is long), what it does in the third,
 * the line that installs it at the side; the scope quieter, the version a tag */
.pkg .head :is(h1, h2) { grid-column: 1 / span 2; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.pkg .head h1 .ns { color: var(--on-leaf-3); }
.pkg .head h1 small { display: inline-block; vertical-align: middle; margin-left: var(--space-ms); padding: 3px var(--space-sm); border-radius: var(--radius-sm); background: var(--tint); font: var(--type-tiny); letter-spacing: 0; color: var(--on-leaf-2); font-variant-numeric: tabular-nums; }
.pkg .head h1 small a { color: inherit; text-decoration: none; }
.pkg .head h1 small a:hover { color: var(--on-leaf); }
.pkg .head > p { grid-area: 1 / 3; }
.pkg .head > .install { grid-area: 1 / 4; justify-self: end; max-width: 100%; margin-top: calc((var(--name) - 1lh - 2 * var(--space-sm)) / 2); overflow: hidden; text-overflow: ellipsis; }
.pkg .head > .install .prompt { opacity: .5; }
.pkg .head > .install:is(:hover, :focus-visible) { background: var(--lit); }
@media (max-width: 1100px) {
  .pkg .head :is(h1, h2) { grid-column: 1 / -1; }
  .pkg .head > p { grid-area: 2 / 1 / auto / -1; }
  .pkg .head > .install { grid-area: 3 / 1 / auto / -1; justify-self: start; margin-top: 0; }
}

/* under it the page's four columns: its contents in the first, kept in sight; the file in the other three */
.pkg .file { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; padding-bottom: var(--space-2xl); }
.pkg .contents { position: sticky; top: var(--space-xl); max-height: calc(100dvh - 2 * var(--space-xl)); overflow: auto; scrollbar-width: none; font: var(--type-small); color: var(--on-leaf-2); }
.pkg .contents ul { margin: var(--space-md) 0 0; padding: 0; list-style: none; }
.pkg .contents a { display: block; padding-block: var(--space-xs); color: inherit; text-decoration: none; transition: color var(--dur-micro); }
.pkg .contents a:is(:hover, [aria-current]) { color: var(--on-leaf); }
.pkg .contents a[aria-current] { font-weight: 600; }
.pkg .contents .up { display: inline-flex; align-items: center; gap: var(--space-sm); font: var(--type-ui); color: var(--on-leaf); }
.pkg .contents .up .i { width: 14px; height: 14px; rotate: 180deg; }
.pkg .contents .up:hover { color: var(--leaf-hot); }
.pkg .dossier { grid-column: 2 / -1; min-width: 0; counter-reset: fig; }
@media (max-width: 1100px) {
  .pkg .file { grid-template-columns: minmax(0, 1fr); }
  .pkg .contents { position: static; max-height: none; margin-bottom: var(--space-lg); }
  .pkg .contents ul { display: none; }
  .pkg .dossier { grid-column: 1; }
}

/* its words clear the sheet's dots, as every block of words does: the file a filled column */
.pkg .dossier > * { position: relative; }
.pkg .dossier :is(.whole, .facts, .plugin, .licences, .readme) { background: var(--leaf); box-shadow: 0 0 0 var(--space-md) var(--leaf); }

/* (a description longer than its head's line, whole, over the facts) */
.pkg .whole { max-width: 72ch; margin: 0 0 var(--space-xl); font: var(--type-lead); text-wrap: pretty; }
/* its facts, a table: what a reader checks before installing */
.pkg .facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl) var(--gap); }
.pkg .facts dl { display: grid; grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); gap: var(--space-sm) var(--space-lg); margin: 0; }
.pkg .facts dl div { display: contents; }
.pkg .facts dt { color: var(--on-leaf-3); }
.pkg .facts dd { margin: 0; overflow-wrap: anywhere; }
.pkg .facts img { max-width: 100%; height: auto; }
.pkg .facts figure { margin: 0; }
@media (min-width: 900px) { .pkg .facts.pictured { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
@media (max-width: 720px) { .pkg .facts dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .pkg .facts dd { margin-bottom: var(--space-sm); } }
.pkg .dossier a { color: inherit; text-decoration-color: var(--on-leaf-3); text-underline-offset: 3px; }
.pkg .dossier a:hover { color: var(--leaf-hot); text-decoration-color: currentColor; }
.pkg .spdx { white-space: nowrap; }

.pkg .dossier h2 { margin: var(--space-2xl) 0 var(--space-md); font: var(--type-group); letter-spacing: var(--track-head); scroll-margin-top: var(--space-lg); }
.pkg .dossier :is(.listen, .plugin, .licences) { margin-top: var(--space-2xl); }
.pkg .dossier :is(.listen, .plugin, .licences) > h2 { margin-top: 0; }
/* its plugin: what a host reads off the package's processor, the manifest's own (scripts/modules-page.mjs plugin):
 * tags of what it is, then a row a parameter, on the columns' own lines down the rows: its name as a script writes
 * it, its range a scale with its default marked on it, the default with its unit, the range in words; an enum its
 * values, the default the heavier. A family's dossier a row a plugin: its name, its tags, how many parameters */
.pkg .tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.pkg .tags li { padding: 1px var(--space-sm); border-radius: var(--radius-sm); background: var(--tint); font: var(--type-small); color: var(--on-leaf-2); white-space: nowrap; }
.pkg .plugin h3 { margin: var(--space-xl) 0 var(--space-sm); font: var(--type-label); scroll-margin-top: var(--space-lg); }
.pkg .plugin code { font: var(--type-code); }
.pkg .plugin dl { display: grid; margin: var(--space-md) 0 0; border-bottom: 1px solid var(--leaf-rule); }
.pkg .plugin dl > div { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; min-height: var(--space-xl); padding-block: var(--space-xs); border-top: 1px solid var(--leaf-rule); }
.pkg .plugin dd { margin: 0; }
.pkg .params { grid-template-columns: minmax(max-content, 10rem) minmax(4rem, 16rem) max-content minmax(0, 1fr); column-gap: var(--space-lg); }
.pkg .params dt small { margin-left: var(--space-sm); font: var(--type-tiny); color: var(--on-leaf-3); }
.pkg .params .scale { position: relative; height: 1px; background: var(--on-leaf-3); }
.pkg .params .scale[data-none] { background: none; }
.pkg .params .scale:not([data-none])::after { content: ''; position: absolute; top: -4px; left: calc(var(--at) * 100% - 1px); width: 2px; height: 9px; background: var(--on-leaf); }
.pkg .params .is { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pkg .params .span { font: var(--type-small); color: var(--on-leaf-3); font-variant-numeric: tabular-nums; }
.pkg .params .of { grid-column: 2 / -1; font: var(--type-small); color: var(--on-leaf-2); }
.pkg .params .of b { font-weight: 600; color: var(--on-leaf); }
.pkg .kinds { grid-template-columns: minmax(max-content, 10rem) minmax(0, 1fr) max-content; column-gap: var(--space-lg); }
.pkg .kinds .n { font: var(--type-small); color: var(--on-leaf-3); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 720px) {
  .pkg .params { grid-template-columns: minmax(0, 1fr) max-content; }
  .pkg .params :is(.scale, .span) { display: none; }
  .pkg .params .of { grid-column: 1 / -1; }
  .pkg .kinds { grid-template-columns: minmax(0, 1fr) max-content; }
  .pkg .kinds dd:not(.n) { grid-area: 2 / 1 / auto / -1; }
}
.pkg .licences p { max-width: 62ch; margin: 0; }

/* what the package does to a sound, Listen: the editor on the site's dark as the home has it, its room (320 px) kept
 * from the first paint; till the first press a still in its place, the sound's name and the edit as the editor's chain
 * names them at its top, a play mark where its play stands; with no script the script it would run. Under it the
 * recording's credit, as the editor writes it */
.listen .player { position: relative; height: 320px; border-radius: var(--radius-sm); overflow: hidden; background: var(--dark); color: var(--on-dark); container-type: inline-size; }
.listen .player:focus { outline: none; }
.listen audio-repl { position: absolute; inset: 0; height: auto; margin: 0; }
.listen audio-repl > pre { margin: 0; padding: var(--space-md); overflow: auto; white-space: pre-wrap; font: var(--type-code); }
.listen .player[data-failed] audio-repl > pre { visibility: visible; }
.listen .still { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; width: 100%; padding: 0 var(--space-md); border: 0; background: var(--dark); color: var(--on-dark); font: var(--type-body); text-align: left; cursor: pointer; }
.listen .still .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-ms); min-height: 36px; }
.listen .still .row > span + span { padding-left: var(--space-ms); border-left: 1px solid var(--dark-rule); font-weight: 600; }
/* (as narrow as the editor lays its chain on a row of its own, under the name: 760 px) */
@container (max-width: 760px) {
  .listen .still .row { flex-direction: column; align-items: flex-start; gap: var(--space-xs); padding-top: var(--space-sm); }
  .listen .still .row > span + span { padding-left: 0; border-left: 0; }
}
.listen .still .go { display: flex; align-items: center; gap: var(--space-md); height: 60px; color: var(--on-dark-2); font: var(--type-small); transition: color var(--dur-micro); }
.listen .still svg { flex: none; width: 24px; height: 24px; fill: var(--on-dark); transition: fill var(--dur-micro); }
.listen .still:hover .go, .listen .still:focus-visible .go { color: var(--hot); }
.listen .still:hover svg, .listen .still:focus-visible svg { fill: var(--hot); }
.listen .still:focus-visible { outline: 2px solid var(--hot); outline-offset: -6px; }
@media (scripting: none) { .listen .still { display: none; } }
.listen .credit { margin: var(--space-sm) 0 0; font: var(--type-small); color: var(--on-leaf-3); overflow-wrap: anywhere; }

/* its README, read: a reading measure, the scale's sizes, code on the page's dark as usage's is */
.pkg .readme { margin-top: var(--space-2xl); }
.pkg .readme > * { max-width: 72ch; }
.pkg .readme > :first-child { margin-top: 0; }
.pkg .readme :is(h3, h4, h5, h6) { scroll-margin-top: var(--space-lg); }
.pkg .readme > h2:first-child { margin-top: 0; }
.pkg .readme h3 { margin: var(--space-xl) 0 var(--space-sm); font: var(--type-label); }
.pkg .readme :is(h4, h5, h6) { margin: var(--space-lg) 0 var(--space-sm); font: var(--type-ui); }
.pkg .readme :is(p, ul, ol) { margin: 0 0 var(--space-md); }
.pkg .readme li { margin: var(--space-xs) 0; }
.pkg :is(.readme, .facts) :not(pre) > code { padding: 1px var(--space-xs); border-radius: var(--radius-sm); background: var(--tint); font: var(--type-code); }
.pkg .readme pre { max-width: none; margin: var(--space-md) 0 var(--space-lg); padding: var(--space-ms) var(--space-md); overflow: auto; border-radius: var(--radius-sm); background: var(--dark); color: var(--on-dark); color-scheme: dark; font: var(--type-code); tab-size: 2; scrollbar-width: thin; }
.pkg .readme pre code { font: inherit; }
.pkg :is(.readme, .licences) table { display: block; max-width: none; margin: var(--space-md) 0 var(--space-lg); overflow-x: auto; border-collapse: collapse; font: var(--type-small); }
.pkg :is(.readme, .licences) th { padding: var(--space-sm) var(--space-md) var(--space-sm) 0; border-bottom: 1px solid var(--on-leaf); text-align: left; font-weight: 600; white-space: nowrap; }
.pkg :is(.readme, .licences) td { padding: var(--space-sm) var(--space-md) var(--space-sm) 0; border-bottom: 1px solid var(--leaf-rule); vertical-align: top; }
.pkg .readme td code { white-space: nowrap; }
.pkg .readme blockquote { margin: var(--space-md) 0; padding: 0 0 0 var(--space-md); border-left: 2px solid var(--on-leaf); color: var(--on-leaf-2); }
.pkg .readme img { max-width: 100%; height: auto; }
.pkg .readme hr { margin: var(--space-xl) 0; border: 0; border-top: 1px solid var(--leaf-rule); }
.pkg .readme sub { font-size: var(--text-xs); color: var(--on-leaf-2); }
.pkg .readme details { margin: 0 0 var(--space-md); }
.pkg .readme summary { cursor: pointer; }
/* a picture a figure, numbered by the page; a plot of the package's own on the page's dark, its inks turned over */
.pkg .dossier figure { margin: var(--space-lg) 0; counter-increment: fig; }
.pkg .dossier figure > img { display: block; }
.pkg .plate { padding: var(--space-ms); border-radius: var(--radius-sm); background: var(--dark); }
.pkg .plate img { display: block; width: 100%; filter: invert(1) hue-rotate(180deg); }
.pkg .dossier figcaption { margin-top: var(--space-sm); font: var(--type-small); color: var(--on-leaf-2); }
.pkg .dossier figcaption::before { content: 'Fig. ' counter(fig) ': '; color: var(--on-leaf-3); }
.pkg .dossier figcaption:empty::before { content: 'Fig. ' counter(fig); }
