/* library.css — the OF Spatial Audio page (variant B: drawings and photographs, plus the live window of OF GROTTA from variant A), beyond OF-Design.
   Needs, in this order: of/fonts/of-fonts.css, of/of-tokens.css, of-campo.css, of-base.css, of-matter.css, of-components.css, of-layout.css.
   Tokens only (var(--of-*)), with one exception: the device panels in «Where to start» carry the poster colours of
   each device (see .lib-dev[data-dev]); OF-Design has no colours per device.
   Prefix lib- = this page. Every of-* class is OF-Design and is not redefined here. */

/* ── Site header (on the ground, not on a photograph): the page on its own only ─ */
.lib-site { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--of-s3) var(--of-s5); width: min(100%, var(--of-page)); margin-inline: auto; padding: var(--of-s4) var(--of-gutter); }
.lib-site .of-bars { font-size: var(--of-fs-h3); border-bottom: 0; }
.lib-site nav { display: flex; flex-wrap: wrap; gap: var(--of-s2) var(--of-s5); font-size: var(--of-fs-value); font-weight: var(--of-w-regular); text-transform: uppercase; letter-spacing: var(--of-tr-label); }
.lib-site nav a { border-bottom: 0; color: var(--of-ink-2); }
.lib-site nav a:hover, .lib-site nav a[aria-current] { color: var(--of-ink); }

/* ── Skip link ──────────────────────────────────────────────────────────────── */
.lib-skip { position: absolute; left: var(--of-gutter); top: calc(-1 * var(--of-touch) * 2); z-index: calc(var(--of-z-header) + 1); padding: var(--of-s2) var(--of-s4); background: var(--of-ground); color: var(--of-ink); border: var(--of-hair) solid var(--of-ink); }
.lib-skip:focus { top: var(--of-s3); }

/* ── Photographs: the opening, and bands between chapters ─────────────────────── */
.lib-band { min-height: clamp(180px, 26vw, 320px); }
.lib-band--open { min-height: clamp(220px, 34vw, 420px); }
/* The six bands (Outer Fields PHOTOS, tools/foto_libreria.py). Not in of-matter.css, which stays upstream.
   The site build rewrites ../of/photos/ to of/photos/ (css/of/photos there). */
.lib-band[data-photo="geyser"]::before  { background-image: url(of/photos/band-geyser.webp);  background-position: center 34%; }
.lib-band[data-photo="costa"]::before   { background-image: url(of/photos/band-costa.webp); }
.lib-band[data-photo="muschio"]::before { background-image: url(of/photos/band-muschio.webp); background-position: center 45%; }
.lib-band[data-photo="basalto"]::before { background-image: url(of/photos/band-basalto.webp); }
.lib-band[data-photo="spruzzo"]::before { background-image: url(of/photos/band-spruzzo.webp); }
.lib-band[data-photo="foresta"]::before { background-image: url(of/photos/band-foresta.webp); background-position: center 30%; }

/* ── Order: one centre, the whole width ───────────────────────────────────────
   Every chapter stands on the axis of the page (user, 29 Nov: «usa meglio spazi orizzontali e tieni allineamenti
   centrali»). Title and lead are centred; running text is a centred column at the reading measure; terms, parts,
   steps, drawings, live windows, the table and the devices spread over the whole page width, in equal columns, and a
   row that is not full is centred too. Inside a chapter every block is one step apart (s6), paragraphs closer (s5);
   chapters are far apart (s8) with a hairline. */
.lib-sec { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; row-gap: var(--of-s6); padding-block: var(--of-s7); scroll-margin-top: calc(var(--of-touch) + var(--of-s3)); }
.lib-sec > * { width: 100%; min-width: 0; }
.lib-sec::before { content: ""; width: 100%; }   /* the hairline, or nothing */
.lib-sec + .lib-sec { padding-top: 0; }
.lib-sec + .lib-sec::before { border-top: var(--of-hair) solid var(--of-unlit); margin-bottom: var(--of-s2); }
.lib-sec > :is(.lib-text, .lib-lead, .lib-term, .lib-audio, p.lib-after) { max-width: var(--of-measure); }
@media (min-width: 1024px) {
  .lib-sec { padding-block: var(--of-s8); }
  .lib-sec + .lib-sec { padding-top: 0; }
  .lib-sec + .lib-sec::before { margin-bottom: calc(var(--of-s8) - var(--of-s6)); }
}

/* ── Opening: the name, then what the page is ─────────────────────────────────── */
.lib-intro { padding-top: var(--of-s7); }
.lib-intro .lib-text > .of-prose:first-child { font-size: var(--of-fs-h3); line-height: 1.55; color: var(--of-ink); text-align: center; text-wrap: balance; }
/* the cover name never wider than a phone (OF-Design keeps it on one line) */
.lib-intro > .of-cover { width: auto; max-width: 100%; padding-bottom: var(--of-s5); }
.lib-intro .of-cover__name { font-size: min(var(--of-fs-name), 12.5vw); }   /* OF Campo: «OF SPATIAL AUDIO» ≈ 6.5 em wide; ≥ 32 px at 320 */

/* ── Titles and text ────────────────────────────────────────────────────────── */
.lib-term { font-family: var(--of-term); font-weight: var(--of-w-regular); font-size: var(--of-fs-h2); line-height: 1.05; letter-spacing: var(--of-tr-label); text-transform: uppercase; color: var(--of-ink); text-align: center; text-wrap: balance; }
.lib-lead { font-size: var(--of-fs-h3); line-height: 1.55; color: var(--of-ink); text-align: center; text-wrap: balance; }
p.lib-after { text-align: center; }
.lib-text { display: grid; row-gap: var(--of-s5); }
.lib-text .of-prose { text-wrap: pretty; }
.lib-text .of-prose + .of-prose { padding-top: 0; }

/* ── Terms: equal columns across the page, the term over what it does, a hairline above each. A row that is not
   full is centred. The same for the terms of a chapter, the family, the glossary and the reading list. ──────── */
.lib-rows, .lib-gloss { --lib-n: 1; display: flex; flex-wrap: wrap; justify-content: center; column-gap: var(--of-s6); }
.lib-rows > .of-say, .lib-gloss > .of-say { flex: 0 0 calc((100% - (var(--lib-n) - 1) * var(--of-s6)) / var(--lib-n)); border-top: var(--of-hair) solid var(--of-unlit); padding-block: var(--of-s3) var(--of-s5); }
.lib-rows > .of-say > b:first-child, .lib-gloss > .of-say > b:first-child { display: block; padding-bottom: var(--of-s1); }
@media (min-width: 640px) { .lib-rows, .lib-gloss { --lib-n: 2; } }
@media (min-width: 1024px) { .lib-rows, .lib-gloss { --lib-n: 4; } .lib-family { --lib-n: 3; } }
/* the family: the shop link stays with its last words */
.lib-family a { white-space: nowrap; }

/* ── Chapter bar: the anchors, sticky at the top ─────────────────────────────── */
.lib-chapters { position: sticky; top: 0; z-index: var(--of-z-header); background: var(--of-ground); padding-block: var(--of-s2); border-bottom: var(--of-hair) solid var(--of-unlit); }
.lib-chapters .of-tabs { width: min(100%, var(--of-page)); margin-inline: auto; padding-inline: var(--of-gutter); }
.lib-chapters .of-tabs > a { border-bottom: 0; }
/* centred on the page axis; auto margins (not justify-content) so a bar wider than the screen still scrolls from its start */
.lib-chapters .of-tabs > a:first-child { margin-left: auto; }
.lib-chapters .of-tabs > a:last-child { margin-right: auto; }
/* the chapter on screen (library.js): drawn as OF-Design draws the current tab */
.lib-chapters .of-tabs > a[aria-current="location"] { color: var(--of-ink); font-weight: var(--of-w-bold); }
.lib-chapters .of-tabs > a[aria-current="location"]::before, .lib-chapters .of-tabs > a[aria-current="location"]::after { content: ""; position: absolute; top: 0; bottom: 0; width: var(--of-bar); background: var(--of-ink); z-index: 1; }
.lib-chapters .of-tabs > a[aria-current="location"]::before { left: calc(-1 * var(--of-hair)); }
.lib-chapters .of-tabs > a[aria-current="location"]::after { right: calc(-1 * var(--of-hair)); }

/* ── Drawings: layouts of speakers and listeners (inline SVG, tokens only) ───── */
.lib-lay { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr)); gap: var(--of-s6) var(--of-s5); }
.lib-lay--two { max-width: 860px; column-gap: var(--of-s7); }
/* «Born in space»: two drawings, each caption centred under its own drawing, the term over the sentence */
.lib-born figure { justify-items: center; text-align: center; row-gap: var(--of-s4); }
.lib-born figure > svg { max-width: 380px; }
.lib-born figcaption { max-width: 36ch; }
.lib-born figcaption .of-say > b:first-child { display: block; padding-bottom: var(--of-s1); }
.dg .ray { stroke: var(--of-unlit); stroke-width: var(--of-hair); vector-effect: non-scaling-stroke; }
.dg .fold { stroke: var(--of-unlit); stroke-width: var(--of-hair); stroke-dasharray: 1 3; vector-effect: non-scaling-stroke; }
.dg .gu { fill: var(--of-ground); stroke: var(--of-ink-2); stroke-width: var(--of-hair); vector-effect: non-scaling-stroke; }
.lib-lay--wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.lib-lay figure > svg { max-width: 360px; }
.lib-lay figure { margin: 0; display: grid; row-gap: var(--of-s3); align-content: start; }
.lib-lay--wide { max-width: 860px; }
.dg { width: 100%; height: auto; display: block; }
.dg .h { fill: none; stroke: var(--of-edge); stroke-width: var(--of-hair); vector-effect: non-scaling-stroke; }
.dg .hd { fill: none; stroke: var(--of-unlit); stroke-width: var(--of-hair); stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.dg .k { fill: none; stroke: var(--of-ink); stroke-width: var(--of-edge-w); vector-effect: non-scaling-stroke; }
.dg .sp { fill: var(--of-ink); }
.dg .g { fill: var(--of-ink-2); }
.dg .gd { fill: var(--of-unlit); }
.dg text { fill: var(--of-ink-2); font-family: var(--of-text); font-weight: var(--of-w-regular); font-size: var(--of-fs-label); }
.dg text.e { fill: var(--of-edge); }

/* ── Live visualizer: the window of OF GROTTA, drawn by the device's own script (from variant A) ── */
.lib-vis { display: grid; row-gap: var(--of-s3); }
.lib-vis canvas { display: block; width: 100%; touch-action: pan-y; cursor: grab; }
.lib-vis canvas:active { cursor: grabbing; }
.lib-vis--scene { padding-top: 0; padding-bottom: var(--of-s7); }
.lib-vis--scene canvas, .lib-vis--tape canvas { aspect-ratio: 752 / 300; }
.lib-vis--out { margin: 0; align-content: start; justify-items: center; text-align: center; }
.lib-vis--out canvas { aspect-ratio: 147 / 92; max-width: 300px; pointer-events: none; }
.lib-outs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--of-s5); }
@media (max-width: 1000px) { .lib-outs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .lib-outs { grid-template-columns: minmax(0, 1fr); } }
/* without JavaScript, or if the visualizer does not run: the device window as a still, in place of the canvases */
.lib-still { width: 100%; height: auto; display: block; }
.no-js .lib-vis canvas, .no-js .lib-vis--tape, .no-js .lib-outs, .no-js .lib-js-only { display: none; }
.js .lib-still, .js .lib-nojs-only { display: none; }

/* ── «With OF CAMPO»: on its own / with OF CAMPO, side by side ───────────────── */
.lib-table { overflow-x: auto; }
.lib-table th:first-child, .lib-table td:first-child { width: 16%; padding-right: var(--of-s5); }
.lib-table:focus-visible { outline: var(--of-edge-w) solid var(--of-ink); outline-offset: 3px; }
.lib-table .of-table { min-width: 520px; }
.lib-table td:first-child { white-space: nowrap; }
.lib-table th, .lib-table td { border-bottom: var(--of-hair) solid var(--of-unlit); padding-block: var(--of-s3); vertical-align: top; }
.lib-table th:last-child, .lib-table td:last-child { color: var(--of-ink); }

/* ── Listening examples (hidden until the recordings exist: see LEGGIMI.md) ─── */
.lib-audio { display: grid; row-gap: var(--of-s4); max-width: var(--of-measure); }
.lib-audio[hidden] { display: none; }
.lib-audio figure { margin: 0; display: grid; row-gap: var(--of-s2); }
.lib-audio audio { width: 100%; }

/* ── The devices, as in the release posters ───────────────────────────────────── */
/* the names are set in var(--of-name): OF Campo (of-campo.css, linked in the page), then Bebas Neue.
   Weight 300 and the tracking are those of the release posters. Every panel ends on its name, so names in a row line up. */
.lib-devs { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--of-s3); }
@media (min-width: 900px) {
  .lib-devs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lib-dev__pic { aspect-ratio: 1520 / 1528; }
  .lib-dev__strip { aspect-ratio: 1120 / 338; }
  .lib-dev[data-dev="campo"] { grid-column: span 2; }
}
.lib-dev { display: grid; align-content: end; padding: var(--of-s7) var(--of-s5) var(--of-s6); border-bottom: 0; background: var(--dev-bg); color: var(--dev-tx); text-decoration: none; }
.lib-dev[data-dev="campo"] .lib-dev__pic, .lib-dev[data-dev="bundle"] .lib-dev__pic { aspect-ratio: auto; }
.lib-dev[data-dev="bundle"] { grid-column: 1 / -1; border: var(--of-hair) solid var(--of-unlit); }
/* poster colours (_lavoro/poster/poster.py; STORMO from its face, as on its page), not tokens */
.lib-dev[data-dev="sabbia"] { --dev-bg: #151412; --dev-tx: #F3E6CC; --dev-ac: #FFB532; }
.lib-dev[data-dev="grotta"] { --dev-bg: #0F0F10; --dev-tx: #CFCFCF; --dev-ac: #FFFFFF; }
.lib-dev[data-dev="nebbia"] { --dev-bg: #A8BFD1; --dev-tx: #0D1824; --dev-ac: #0345C7; }
.lib-dev[data-dev="stormo"] { --dev-bg: #0A100D; --dev-tx: #C9DDD2; --dev-ac: #6BE8A3; }
.lib-dev[data-dev="campo"]  { --dev-bg: #FAFAF9; --dev-tx: #101011; --dev-ac: #66666B; }
.lib-dev[data-dev="bundle"] { --dev-bg: var(--of-ground); --dev-tx: var(--of-ink); --dev-ac: var(--of-ink-2); }
/* Device names in the text, each in its own colour (tools/color_names.py writes the spans).
   From the posters, lifted where the poster colour is too dark on black:
   NEBBIA takes its face, CAMPO a lighter step of its grey (#66666B is 3.7:1 on black). */
.lib-nm { white-space: nowrap; }
.lib-nm[data-dev="sabbia"] { color: #FFB532; }
.lib-nm[data-dev="grotta"] { color: #FFFFFF; }
.lib-nm[data-dev="nebbia"] { color: #A8BFD1; }
.lib-nm[data-dev="stormo"] { color: #6BE8A3; }
.lib-nm[data-dev="campo"]  { color: #9C9CA3; }
.lib-nm[data-dev="bundle"] { color: var(--of-ink); }
.lib-dev__pic { display: flex; align-items: flex-end; }
.lib-dev img { width: 100%; height: auto; display: block; }
.lib-dev__strip { display: block; margin-top: var(--of-s4); }
.lib-dev__pics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--of-s2); width: 100%; }
.lib-dev__nm { font-family: var(--of-name); font-weight: 300; font-size: clamp(2.75rem, 4.6vw, 4.5rem); line-height: 0.9; letter-spacing: 0.045em; padding-top: var(--of-s6); }
.lib-dev__sub { font-family: var(--of-text); font-size: var(--of-fs-label); letter-spacing: 0.42em; color: var(--dev-ac); padding-top: var(--of-s4); }
.lib-dev:hover .lib-dev__sub { text-decoration: underline; text-underline-offset: 0.3em; }
.lib-dev:focus-visible { outline: var(--of-edge-w) solid var(--of-ink); outline-offset: 3px; }

/* ── Glossary ────────────────────────────────────────────────────────────────── */
.lib-gloss .of-say { scroll-margin-top: calc(var(--of-touch) + var(--of-s5)); }
.lib-gloss .of-say:target > b:first-child { text-decoration: underline; text-underline-offset: 0.2em; }

/* ── Site footer (the page on its own); credits (in the site) ───────────────── */
.lib-foot { width: min(100%, var(--of-page)); margin-inline: auto; padding: var(--of-s7) var(--of-gutter) var(--of-s6); display: grid; row-gap: var(--of-s3); font-size: var(--of-fs-value); color: var(--of-ink-2); }
.lib-foot hr { margin: 0 0 var(--of-s4); }
.lib-foot nav { display: flex; flex-wrap: wrap; gap: var(--of-s2) var(--of-s5); }
.lib-foot a { border-bottom: 0; }
.lib-foot a:hover { color: var(--of-ink); }

/* MAP (OF CAMPO, 2026-12-01): the three views of its second window, across the full width, one row from 720 px */
.lib-map__lead { padding-top: var(--of-s7); margin-inline: auto; }
.lib-map { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--of-s6) var(--of-s5); padding-block: var(--of-s6) var(--of-s7); }
.lib-map figure { margin: 0; display: grid; row-gap: var(--of-s3); align-content: start; }
.lib-map img { width: 100%; height: auto; display: block; outline: var(--of-hair) solid var(--of-unlit); }
@media (min-width: 720px) { .lib-map { grid-template-columns: repeat(2, minmax(0, 1fr)); } }   /* 2026-12-02: MAP v10, two views */
