/* The pearl chain: her timeline (Sandra's voice note, 22.10: "eine riesenlange gefädelte Perlenkette … wenn das quasi die
   Timeline wäre"). Layout of the controller in chain.js; the beads themselves are drawn by a drawing (chain-perlen.js).
   Two modes:
   - the list (default, and without JavaScript, under reduced motion, on screens too short for the stage): the chain stands
     still above as decoration, and every station's text is read in a list beneath it;
   - the runway (.ch-run, set by chain.js): a tall section with a sticky stage; scrolling down moves the chain from right to
     left, the bead in the middle opens and its whole entry stands in a box under the chain, one at a time; an entry
     longer than the box is read page by page ("Weiter", "Zurück"), never in a scrolling box.
   Only her tokens: paper, ink, her accent, Cinzel at the title size, her link (.go), her --ease-out. */

.chain {
  --ch-band: 170px;          /* the chain's own strip, a little taller than its largest open bead and its wave */
  z-index: 4;
  background: var(--paper);  /* her paper, the nearest of her grounds to the white wall in her photos */
  padding: var(--gap) var(--side) calc(var(--gap) + var(--sheet));
}

/* the band the chain runs through: the whole width of the screen, its ends cut by the screen's edges */
.ch-band {
  position: relative;
  height: var(--ch-band);
  margin: 0 calc(-1 * var(--side));
  overflow: clip;
}
.ch-strip { position: absolute; left: 0; top: 0; height: 100%; }
.ch-mount, .ch-hits { position: absolute; inset: 0; }
.ch-svg { position: absolute; left: 0; top: 0; display: block; overflow: visible; }
/* without JavaScript nothing is drawn: her hairline stands in for the thread */
html:not(.js) .ch-band::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--ink);
  opacity: .35;
}

/* a station bead opens about its own centre; its highlight brightens as it opens (class "hl" in any drawing) */
.ch-st { transform-box: fill-box; transform-origin: center; }
.ch-svg .hl { opacity: .55; transition: opacity 150ms var(--ease-out); }
.ch-svg .ch-st.is-open .hl { opacity: 1; transition-duration: 250ms; }

/* the station buttons: invisible, over each station bead, 48 px for a finger; a ring in her accent when focused */
.ch-hits { display: none; }
.ch-hit {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ch-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ch-skip, .ch-drop, .ch-back, .ch-next { display: none; }

/* ---------- the list: every station, her chronology, readable at once ---------- */
.ch-read { max-width: var(--wrap); margin: clamp(32px, 4vw, 56px) auto 0; }
.ch-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 28px clamp(28px, 3vw, 48px);
}
.ch-item { padding-top: 14px; border-top: 1px solid var(--hair); }
.ch-label {
  font-family: "Cinzel", serif;
  font-size: var(--fs-title);
  line-height: 1.22;
  color: var(--ink);
  hyphens: auto;   /* her long words ("Rehabilitationspädagogik") break at a syllable rather than leave their column */
}
/* her date above her title, in Cinzel at body size and her accent: "1977", "11/ 2011", "Während meiner Schulzeit" */
.ch-year { display: block; margin-bottom: .3em; font-size: var(--fs-body); letter-spacing: .04em; color: var(--accent); }
/* the way in: the eyebrow in her warm accent, spaced capitals (the old "Beispiel" line Heinz liked), the heading in her body
   font, larger (Heinz, 24.10: "it looked way better without Cinzel there") */
.ch-intro { margin-bottom: 28px; text-align: center; }
.ch-tag {
  display: block;
  margin-bottom: .6rem;
  font-family: var(--unterzeile), "Nunito Sans", system-ui, sans-serif;
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: .2em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--accent-warm);
}
.ch-intro-title { display: block; font-size: var(--fs-title); font-weight: 400; line-height: 1.3; color: var(--ink); }
.ch-text, .ch-more { color: var(--ink-soft); }
.ch-text { margin-top: .5em; }
.ch-more p { margin-top: .75em; }
/* her heading without a date, inside the entry before it */
.ch-more .ch-sub { margin-top: 1.1em; font-weight: 700; color: var(--ink); }

/* ---------- the runway: held stage, the chain at about two fifths of the screen, one entry under it ---------- */
.chain.ch-run { padding: 0; }
.ch-run .ch-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  /* the band's middle at 34 % of the screen: 41 %, where it stood before her long entries came in (97046ace), then 7 % of
     the screen higher (Heinz, 24.10, on his 1728 × 996); the box under it takes the room that is left */
  padding-top: calc(34svh - var(--ch-band) / 2);
}
.ch-run .ch-band { margin: 0; flex: none; }
.ch-run .ch-hits { display: block; }

/* a short hairline from the open bead down to its text, drawn as the text comes and taken back as it goes */
.ch-run .ch-drop {
  display: block;
  flex: none;
  width: 1px;
  height: 28px;
  margin: 4px auto 14px;
  background: var(--ink);
  opacity: .3;
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform 150ms var(--ease-out);
}
.ch-run.has-open .ch-drop { transform: none; transition-duration: 250ms; }

/* the box: about 14 to 15 of her words a line (it held about 12 at 30rem), every entry in the same place, as tall as the
   room down to the stage's foot (--ch-box, set by chain.js), so the chain never moves */
.ch-run .ch-read {
  flex: none;
  margin: 0 auto;
  width: 100%;
  max-width: calc(38rem + 2 * var(--side));
  padding: 0 var(--side);
  text-align: center;
}
.ch-run .ch-list { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--ch-box, 50svh); gap: 0; }
.ch-run .ch-read { display: grid; grid-template-columns: minmax(0, 1fr); }
.ch-run .ch-read > .ch-intro, .ch-run .ch-read > .ch-list { grid-area: 1 / 1; }
.ch-run .ch-intro { margin: 0; align-self: start; }
.ch-run .ch-item,
.ch-run .ch-intro {
  grid-area: 1 / 1;
  position: relative;
  height: var(--ch-box, 50svh);
  overflow: hidden;
  padding: 0;
  border: 0;
  opacity: 0;
  translate: 0 -8px;
  visibility: hidden;
  pointer-events: none;
  /* leaving: scrolling on, the entry fades and drops down, and the next one drops in from above; scrolling back, it rises
     up and the one before rises in from below, in 160 ms, by 8 px only, so it reads as a soft settle, not a
     fall (Heinz, 24.10: "down down", and up when going back; "zu weit, sie sollte sanfter sein") */
  transition: opacity 160ms var(--ease-out), translate 160ms var(--ease-out), visibility 0s linear 160ms;
}
/* an entry she has scrolled past waits below, one still to come above */
.ch-run .ch-item.is-past,
.ch-run .ch-intro.is-past { translate: 0 8px; }
/* coming, as its large bead nears the middle (chain.js sets is-on): it drops in from above, overlapping
   the old one's last moment, in 240 ms; crossing back retargets the transitions, so it runs backwards */
.ch-run .ch-item.is-on,
.ch-run .ch-intro.is-on {
  opacity: 1;
  translate: 0 0;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms var(--ease-out) 80ms, translate 240ms var(--ease-out) 80ms, visibility 0s linear 80ms;
}

/* her lines, each its own block, so a page ends between two lines (chain.js splits them; the words stay hers) */
.ch-run .ch-title { display: block; }
.ch-run .ln { display: block; }
/* her lines are set without hyphens, so each line holds whole words; a word wider than the box alone ("Rehabilitations-
   pädagogik" in the title on a phone) breaks at a syllable inside its own line (chain.js marks it) */
.ch-run .ch-label { hyphens: manual; }
.ch-run .ln.is-long { hyphens: auto; }

/* one page of the entry: the pane holds the flow of her text, shifted to the page's first line and cut after its last */
.ch-run .ch-pane { position: absolute; left: 0; right: 0; top: 0; }
.ch-run .ch-flow { position: relative; }

/* paging a long entry: "Zurück ↑" at the box's top from the second page on, "Weiterlesen ↓" right under the page's last
   line while more follows (its top set by chain.js) */
.ch-run .ch-back, .ch-run .ch-next {
  display: inline-flex;
  position: absolute;
  left: 50%;
  z-index: 1;   /* above the pane, which covers the whole box */
  transform: translateX(-50%);
  white-space: nowrap;
}
.ch-run .ch-back { top: 0; }
.ch-run .ch-back[hidden], .ch-run .ch-next[hidden] { display: none; }
.ch-run .ch-back .ar, .ch-run .ch-next .ar { transition: transform var(--hover); }
.ch-run .ch-next:focus-visible .ar { transform: translateY(3px); }
.ch-run .ch-back:focus-visible .ar { transform: translateY(-3px); }
@media (hover: hover) and (pointer: fine) {
  .ch-run .ch-next:hover .ar { transform: translateY(3px); }
  .ch-run .ch-back:hover .ar { transform: translateY(-3px); }
}

/* her choice: a small way past the chain, at the stage's foot (before the chain for the keyboard) */
.ch-run .ch-skip {
  display: block;
  position: absolute;
  right: var(--side);
  bottom: clamp(16px, 4svh, 40px);
  z-index: 2;
}

@media (max-width: 860px) {
  .chain { --ch-band: 130px; }
}
@media (max-width: 600px) {
  .ch-list { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .ch-run .ch-skip { right: auto; left: var(--side); }
}

/* reduced motion: the chain still follows the scroll, and an entry is swapped for the next at the same point, at once and
   without blur; the line and the highlight change at once */
@media (prefers-reduced-motion: reduce) {
  .ch-svg .hl, .ch-drop { transition-duration: .01ms !important; }
  .ch-run .ch-item, .ch-run .ch-item.is-on, .ch-run .ch-intro, .ch-run .ch-intro.is-on { translate: none; transition-duration: .01ms !important; transition-delay: 0s !important; }
}

/* the skip link's target, her voices since they follow the chain, takes focus so the keyboard continues after the chain; it
   needs no ring of its own */
#stimmen-sec:focus { outline: none; }
