/* Block 10a · Erster Termin (V8-BLOCKS-R1 §1.2) + the gallery helper (.gal, _tools/kit_gallery.py, js/core/gallery.js).
   Concept: a contact sheet held up beside the reading column: the picture follows the line being read.
   Static layout (phones, no JS, reduced motion, and whenever the JS layout is off): each item with its own picture in
   normal flow (≥ 810: picture cols 1–7 beside its text cols 8–12; P: text, then the picture). Live layout (≥ 810,
   html.motion:not(.rm)): one frame cols 1–7, sticky from the H2's top to the list's end, the list cols 8–12 at 1 : 1. */
.et { background: var(--paper); }

/* ---- shared parts ---- */
.gal-list { grid-column: 1 / -1; position: relative; min-width: 0; }
.gal-h { margin: 0 0 var(--gap-stack); overflow-wrap: break-word; }
.gal-items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap-stack); }
.gal-text { display: grid; gap: 12px; min-width: 0; overflow-wrap: break-word; }
.gal-title { margin: 0; }
.gal-text .t-body { margin: 0; max-width: 32em; }
.gal-ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gal-a { color: inherit; text-decoration: none; display: inline-flex; align-items: baseline; gap: .25em; }
.gal-a:hover > span:first-child { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .14em; }
.gal-arrow { display: inline-grid; place-items: center; width: .62em; height: .62em; flex: none; transform: translateY(.06em); transition: transform var(--dur-ui) var(--ease-ui); }
.gal-arrow svg { width: 100%; height: 100%; }
@media (hover: hover) { .gal-a:hover .gal-arrow { transform: translate(4px, .06em); } }   /* the link answers the pointer */
.gal-own { display: block; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--mist); margin-top: 24px; }
.gal-own img, .gal-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gal-side, .gal-rule { display: none; }

/* ---- static ≥ 810: rows, picture left beside its own text ---- */
@media (min-width: 810px) {
  .gal-list { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap-grid); }
  .gal-h { grid-column: 8 / -1; }
  .gal-items { grid-column: 1 / -1; display: grid; gap: var(--gap-stack-l); }
  .gal-item { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap-grid); align-items: start; }
  .gal-own { grid-column: 1 / 8; grid-row: 1; margin: 0; border-radius: var(--r-lg); }
  .gal-text { grid-column: 8 / -1; grid-row: 1; }
}

/* ---- live ≥ 810: one held frame, the list moves ---- */
@media (min-width: 810px) {
  html.motion:not(.rm) .gal-side { display: block; grid-column: 1 / 8; grid-row: 1; align-self: stretch; min-width: 0; }
  html.motion:not(.rm) .gal-hold { position: sticky; top: calc(var(--nav-bottom) + 48px); will-change: transform; }
  html.motion:not(.rm) .gal-frame {
    position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-lg); overflow: hidden; background: var(--mist);
    transform-origin: 50% 100%; will-change: transform;
  }
  html.motion:not(.rm) .gal-img { position: absolute; inset: 0; display: block; opacity: 0; }
  html.motion:not(.rm) .gal-img.is-on { opacity: 1; }
  html.motion:not(.rm) .gal-veil { position: absolute; inset: 0; background: var(--veil); opacity: 0; pointer-events: none; }
  html.motion:not(.rm) .gal-list { grid-column: 8 / -1; grid-row: 1; display: block; }
  html.motion:not(.rm) .gal-items { display: block; }
  /* each item's top crosses the viewport's middle once, and its text reads beside the frame */
  html.motion:not(.rm) .gal-item { display: block; min-height: 56svh; }
  /* the last item is as tall as the frame: the hold ends with its text beside the frame, and both leave together
     (--gal-fh = the frame's height, set by js/core/gallery.js; the fallback is the same number from the grid) */
  html.motion:not(.rm) .gal-item:last-child { min-height: var(--gal-fh, min(calc((100vw - 80px) * .4375 - 7.5px), 517.5px)); }
  html.motion:not(.rm) .gal-own { display: none; }
  /* makro's active-item mark: a 2 px lime rule left of the text being read (a mark, not text) */
  html.motion:not(.rm) .gal-rule {
    display: block; position: absolute; left: -20px; top: 0; width: 2px; height: 100px; border-radius: 1px;
    background: var(--lime); transform-origin: 0 0; opacity: 0; will-change: transform;
  }
  html.motion:not(.rm) .gal.is-live .gal-rule { opacity: 1; }
}

/* T: the frame keeps cols 1–7, the rule sits closer in the narrower gutter */
@media (min-width: 810px) and (max-width: 1199.98px) {
  html.motion:not(.rm) .gal-rule { left: -14px; }
}

/* touch: item links at 44 px (35 px at 390; phone pass 2026-10-22) */
@media (pointer: coarse) { .gal-a { min-height: 44px; align-items: center; } }
