/* ==========================================================================
   SYNC — Beyond the Physical Stage
   Publication: sheet, page grid and editorial components.
   Shared by screen.css (browser review) and print.css (PDF export).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--din);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

/* ---- Sheet & page ---------------------------------------------------------
   .sheet  = the physical A4 leaf (size container; scaled on screen).
   .page   = the layout canvas: a grid of
             columns  [bleed-l] margin  c1 … c10  margin [bleed-r]
             rows     [head] top margin  r1 … r51  [foot] bottom margin [end]
   Place any child with two custom properties (grid lines):
     --c: c 5 / c 11      → columns 5–10
     --r: r 4 / span 8    → 8 baselines starting at baseline 4
   Full bleed:  --c: bleed-l / bleed-r
   ------------------------------------------------------------------------- */
.sheet {
  position: relative;
  container-type: inline-size;
  width: var(--sheet, 210mm);
  aspect-ratio: 210 / 297;
  background: var(--paper);
  color: var(--ink);
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns:
    [bleed-l] calc(var(--margin-x) - var(--gutter))
    repeat(10, [c] minmax(0, 1fr))
    [c] calc(var(--margin-x) - var(--gutter)) [bleed-r];
  grid-template-rows:
    [head] var(--margin-top)
    repeat(51, [r] var(--bl))
    [r foot] var(--margin-bottom) [end];
  column-gap: var(--gutter);
  font-size: var(--fs-body);
  line-height: var(--bl);
}
.page > * {
  grid-column: var(--c, c 1 / c 11);
  grid-row: var(--r, auto);
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.page--ink { background: var(--ink); color: var(--paper); --muted: var(--ink-muted); --line: var(--ink-line); }

/* ---- Page furniture ------------------------------------------------------ */

/* Running head & cover masthead: the GT split masthead (GALLERI … TRAPPAN).
   Across a spread the name splits: SYNC on the verso, SPATIAL MUSIC on the recto. */
.runhead, .masthead {
  --r: head / r 1;
  align-self: start;
  padding-top: calc(10 * var(--mm));
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
  font-size: var(--fs-micro);
  line-height: 1;
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
}
.runhead > *, .masthead > * { margin: 0; }
.runhead__name, .masthead__name {
  font-weight: 700;
  font-size: var(--fs-mast);
  letter-spacing: var(--track-mast);
}
.runhead--verso .runhead__name    { grid-column: 1 / 5; }
.runhead--verso .runhead__section { grid-column: 5 / 11; }
.runhead--recto .runhead__section { grid-column: 1 / 7; }
.runhead--recto .runhead__name    { grid-column: 7 / 11; justify-self: end; }
.masthead > :nth-child(1) { grid-column: 1 / 4; }
.masthead > :nth-child(2) { grid-column: 5 / 9; }
.masthead > :nth-child(3) { grid-column: 9 / 11; justify-self: end; }

.folio {
  --r: foot / end;
  align-self: start;
  padding-top: calc(10 * var(--mm));
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--track-mast);
  line-height: 1;
}
.folio--verso { --c: c 1 / c 3; }
.folio--recto { --c: c 9 / c 11; justify-self: end; }

/* ---- Type ---------------------------------------------------------------- */

.kicker {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
  line-height: var(--bl);
}

/* Cover title — GT h1 */
.display {
  font-weight: 700;
  font-size: var(--fs-display);
  line-height: .86;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  /* optical: pull cap height up to the top of its grid area */
  margin-top: -0.06em;
}

/* Section title — GT h2 (condensed) */
.title {
  font-family: var(--cond);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: .95;
  letter-spacing: .005em;
  text-transform: uppercase;
  margin-top: -0.12em;
}

/* Chapter number — GT .call .num */
.num {
  font-family: var(--cond);
  font-weight: 700;
  font-size: var(--fs-num);
  line-height: .8;
}

/* GT .lede (uppercase, regular) */
.lede {
  font-size: var(--fs-lede);
  line-height: 1.1;
  text-transform: uppercase;
  max-width: 34ch;
}
/* GT .calls-intro p */
.statement {
  font-size: var(--fs-statement);
  line-height: 1.12;
  text-transform: uppercase;
  max-width: 24ch;
}
.pull {
  font-size: var(--fs-pull);
  line-height: 1.08;
  text-transform: uppercase;
}
/* GT .facts (condensed bold caps) */
.facts {
  font-family: var(--cond);
  font-weight: 700;
  font-size: var(--fs-facts);
  line-height: 1.05;
  text-transform: uppercase;
}

.standfirst {
  font-size: var(--fs-standfirst);
  line-height: calc(1.4 * var(--bl));
}

/* Running text: 10 / 14.17 pt, paragraphs separated by one baseline (GT spacing) */
.text {
  hyphens: auto; -webkit-hyphens: auto;
  hyphenate-limit-chars: 9 4 4;     /* only long words, ≥ 4 letters each side */
  /* normal wrapping: lines fill before breaking (no pretty/balance) */
}
.text > * { margin: 0; }
.text > * + * { margin-top: var(--bl); }
.text .standfirst + p { margin-top: calc(1.4 * var(--bl)); }

.caption {
  font-size: var(--fs-caption);
  line-height: var(--lh-small);
  color: var(--muted);
}
.caption b { color: var(--ink); font-weight: 700; letter-spacing: .04em; margin-right: .5em; }

/* Node rule above a section title: five nodes from the Sync dot mark,
   on the footprint of the GT poster rule (22 mm). Vector mask, takes currentColor. */
.rule {
  display: block;
  width: calc(22 * var(--mm));
  height: calc(2.2 * var(--mm));
  background: currentColor;
  -webkit-mask: var(--node-row) center / 100% 100% no-repeat;
  mask: var(--node-row) center / 100% 100% no-repeat;
  align-self: start;
  --node-row: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 2.2'%3E%3Cg%3E%3Ccircle cx='1.1' cy='1.1' r='1.1'/%3E%3Ccircle cx='6.05' cy='1.1' r='1.1'/%3E%3Ccircle cx='11' cy='1.1' r='1.1'/%3E%3Ccircle cx='15.95' cy='1.1' r='1.1'/%3E%3Ccircle cx='20.9' cy='1.1' r='1.1'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- Figures ------------------------------------------------------------- */
.fig { display: flex; flex-direction: column; }
.fig > img { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.fig--contain > img { object-fit: contain; }
.fig > figcaption { flex: none; margin-top: calc(0.6 * var(--bl)); }
.fig--bleed > figcaption { padding-inline: var(--margin-x); }

/* ---- Contents as a Sync score -------------------------------------------
   Borrowed from the Sync performer interface: each chapter is a note on its
   own staff line; the note's position and length show where the chapter sits
   in the publication (time = pages, --from … --to). A signal-coloured
   playhead marks "you are here". Columns follow the page grid:
   number (col 1) · title (cols 2–4) · track (cols 5–9, under the 6-col text) · page (col 10). */
.score {
  --score-cols: var(--col) calc(3 * var(--col) + 2 * var(--gutter)) calc(5 * var(--col) + 4 * var(--gutter)) minmax(0, 1fr);
  --span: calc(var(--to) - var(--from));
  display: flex;
  flex-direction: column;
  justify-content: end;
}
.score ol { list-style: none; margin: 0; padding: 0; }
.score a {
  display: grid;
  grid-template-columns: var(--score-cols);
  column-gap: var(--gutter);
  align-items: center;
  height: calc(2 * var(--bl));
  color: inherit;
  text-decoration: none;
  line-height: 1;
}
.score__n { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.score__t { font-size: var(--fs-body); white-space: nowrap; }
.score__p { justify-self: end; font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; }

.score__track { position: relative; align-self: stretch; }
.score__track::before {                     /* staff line */
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: max(1px, calc(.2 * var(--mm))) solid var(--line);
}
.score__track::after {                      /* playhead: rows touch, so the segments form one line */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: max(1px, calc(.35 * var(--mm))) solid var(--signal);
}
.score__track i {                           /* the note */
  position: absolute; top: 50%;
  left: calc((var(--at) - var(--from)) / var(--span) * 100%);
  width: calc(var(--len) / var(--span) * 100%);
  height: calc(1.2 * var(--mm));
  transform: translateY(-50%);
  background: var(--ink);
}
.score__track i::before {                   /* node at the note's onset */
  content: ""; position: absolute; left: 0; top: 50%;
  width: calc(2.6 * var(--mm)); height: calc(2.6 * var(--mm));
  border-radius: 50%; background: inherit;
  transform: translate(-50%, -50%);
}

.score__axis {
  display: grid;
  grid-template-columns: var(--score-cols);
  column-gap: var(--gutter);
  height: var(--bl);
  font-size: var(--fs-micro);
  color: var(--muted);
}
.score__ticks { grid-column: 3; position: relative; }
.score__ticks span { position: absolute; top: calc(1.2 * var(--mm)); left: calc((var(--at) - var(--from)) / var(--span) * 100%); transform: translateX(-50%); line-height: 1; }

/* ---- Imprint (GT footer pattern) ----------------------------------------- */
.imprint {
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  border-top: max(1px, calc(.25 * var(--mm))) solid var(--line);
  padding-top: calc(0.8 * var(--bl));
}
.imprint > div:nth-child(1) { grid-column: 1 / 5; }
.imprint > div:nth-child(2) { grid-column: 5 / 8; }
.imprint > div:nth-child(3) { grid-column: 8 / 11; }
.imprint h3, .label {
  margin: 0 0 calc(0.5 * var(--bl));
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
  line-height: var(--lh-small);
  color: var(--muted);
}
.imprint p { margin: 0 0 calc(0.5 * var(--bl)); font-size: var(--fs-caption); line-height: var(--lh-small); }

.brandmark { width: calc(18 * var(--mm)); height: auto; align-self: end; color: var(--ink); }

/* ---- Cover --------------------------------------------------------------- */
.cover-foot {
  --r: foot / end;
  display: grid;
  grid-template-columns: subgrid;
  align-self: start;
  padding-top: calc(5 * var(--mm));
}
.cover-foot > * { margin: 0; }
.cover-foot > :first-child { grid-column: 1 / 6; }
.cover-foot > :last-child  { grid-column: 6 / 11; justify-self: end; text-align: right; }

/* ---- Diagrams ------------------------------------------------------------- */
.diagram { color: var(--ink); }
.diagram svg { width: 100%; height: auto; overflow: visible; }
.diagram text { font-family: var(--din); font-weight: 700; }

.legend {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  border-top: max(1px, calc(.25 * var(--mm))) solid var(--line);
  padding-top: calc(0.6 * var(--bl));
  font-size: var(--fs-caption);
  line-height: var(--lh-small);
}
.legend li { display: flex; gap: calc(2.5 * var(--mm)); align-items: center; }
.legend li:nth-child(1) { grid-column: 1 / 4; }
.legend li:nth-child(2) { grid-column: 4 / 7; }
.legend li:nth-child(3) { grid-column: 7 / 11; }
/* legend symbols are drawn 1 : 1 with the diagram (viewBox units = mm) */
.legend svg { flex: none; width: calc(14 * var(--mm)); height: calc(14 * var(--mm)); }
.legend b { display: block; font-size: var(--fs-micro); letter-spacing: var(--track-kicker); text-transform: uppercase; }

/* Visually hidden (screen readers only) */
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Schematics -----------------------------------------------------------
   Same drawings and classes as the website (website/src/components/diagrams/),
   mapped to the publication's tokens. SVG font sizes are in user units, so
   type scales with each figure. --dgm-bg masks lines behind nodes and rings. */
.dgm { --dgm-bg: var(--paper); display: block; width: 100%; height: auto; overflow: visible; color: inherit; }
.page--ink .dgm { --dgm-bg: var(--ink); }
.dgm text { font-family: var(--din); fill: currentColor; }
.dgm .lbl { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.dgm .txt { font-size: 14px; }
.dgm .seq { font-size: 15px; font-weight: 700; }
.dgm .frame { fill: none; stroke: currentColor; stroke-width: 1.3; }
.dgm .node { fill: currentColor; }
.dgm .aud { fill: var(--dgm-bg); stroke: currentColor; stroke-width: 1.1; }
.dgm .flow { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; }
.dgm .arrow { fill: var(--signal); }
.dgm .ring { fill: var(--dgm-bg); stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 4 3; }
.dgm .ring--open { fill: none; }
.dgm .spk { fill: var(--dgm-bg); stroke: currentColor; stroke-width: 1.4; }
.dgm .sensor { fill: var(--sensor); }
.dgm .cable { fill: none; stroke: var(--signal); stroke-width: 1.5; }
.dgm .leader { fill: none; stroke: currentColor; stroke-width: .8; opacity: .55; }
.dgm .hair { fill: none; stroke: currentColor; stroke-width: .9; opacity: .3; }
.dgm .beam { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 4; opacity: .55; }
.dgm .solid { fill: currentColor; }

/* System architecture diagram (website ArchitectureDiagram.astro) */
.arch { display: block; width: 100%; height: auto; overflow: visible; color: inherit; }
.arch text { fill: currentColor; font-family: var(--din); }
.arch__box { fill: none; stroke: currentColor; stroke-width: 1.5; }
.arch__box--dash { stroke-dasharray: 5 4; }
.arch__dash { stroke: currentColor; stroke-width: 1.2; stroke-dasharray: 5 4; }
.arch__kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.arch__title { font-size: 24px; font-weight: 700; }
.arch__text { font-size: 17px; }
.arch__small { font-size: 14px; opacity: .75; }
.arch__flow { stroke: var(--signal); stroke-width: 2; fill: none; }
.arch__device { fill: none; stroke: currentColor; stroke-width: 1.5; }
.arch__device-base { stroke: currentColor; stroke-width: 3; }
.arch__staff { stroke: currentColor; stroke-width: .8; opacity: .45; }
.arch__note { fill: currentColor; }
.arch__node { fill: currentColor; opacity: .35; }
.arch__node--on { fill: var(--signal); opacity: 1; }

/* Typographic figures (funding, scale) and numbered lists (collaboration) */
.bignum { font-family: var(--cond); font-weight: 700; font-size: calc(64 * var(--pt)); line-height: .85; }
.bignum + .label { margin-top: calc(.6 * var(--bl)); }
.calls { list-style: none; padding: 0; margin: 0; }
.calls li { border-top: max(1px, calc(.25 * var(--mm))) solid var(--line); padding: calc(.7 * var(--bl)) 0 calc(1.2 * var(--bl)); display: grid; grid-template-columns: calc(2 * var(--col) + var(--gutter)) 1fr; column-gap: var(--gutter); }
.calls li:last-child { border-bottom: max(1px, calc(.25 * var(--mm))) solid var(--line); }
.calls__n { font-family: var(--cond); font-weight: 700; font-size: calc(28 * var(--pt)); line-height: 1; }
.calls h3 { margin: 0 0 calc(.4 * var(--bl)); font-family: var(--cond); font-weight: 700; text-transform: uppercase; font-size: calc(18 * var(--pt)); line-height: 1.05; }
.calls p { margin: 0; }
.page--ink .imprint h3, .page--ink .label { color: var(--ink-muted); }
.page--ink .caption b { color: var(--paper); }

/* ---- Pages 8–28: small page-specific pieces ------------------------------ */
.mode-text { align-self: center; }
.mode-text > * { margin: 0; }
.mode-h { font-family: var(--cond); font-weight: 700; text-transform: uppercase; font-size: calc(22 * var(--pt)); line-height: 1; margin: calc(.3 * var(--bl)) 0 calc(.5 * var(--bl)) !important; }
.provides { border-top: 0; padding-top: 0; align-content: end; }
.provides > div { grid-column: 1 / -1 !important; }
.provides h3 + p { margin-bottom: var(--bl); }
.scale-figs { align-self: end; }
.scale-figs > * { margin: 0; }
.scale-figs .label { margin-bottom: var(--bl); }
.funding > * { margin: 0; }
.funding-rows { margin-top: var(--bl) !important; }
.funding-rows li { padding-bottom: calc(.7 * var(--bl)); }
.funding-note { margin-top: var(--bl) !important; max-width: 60ch; color: var(--muted); }
.contact-title { font-size: calc(72 * var(--pt)); }
.contact-name { font-size: var(--fs-standfirst) !important; line-height: 1.3 !important; font-weight: 700; }
.notes p b { font-weight: 700; }
.page--ink .brandmark { filter: invert(1); }
.brandmark--back { width: 100%; height: auto; align-self: center; }
.back-name { font-weight: 700; font-size: calc(14 * var(--pt)); letter-spacing: .12em; text-transform: uppercase; text-align: center; align-self: start; }

.page--ink .diagram { color: var(--paper); }   /* schematics on dark pages draw in paper colour */
