/* Totemphonia v2 · home: clearing (wave field) → one pinned stand per project → totem. See v2/DESIGN.md §4, §33. */

:root { --em: clamp(170px, 31vmin, 350px); }
.em { width: 100%; height: 100%; overflow: visible; fill: currentColor; }
/* the figures (figures.js, home-figures.js): a canvas 1.4 × the box behind it, so spikes and bursts may reach out;
   the baked disc stays inside as the image without JS */
.fig { position: absolute; left: -20%; top: -20%; width: 140%; height: 140%; pointer-events: none; }
.has-figure > .em { visibility: hidden; }
button.frame__em { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; } /* touch: a held finger points at the figure (figures.js), no callout, no selection, no double-tap zoom */
.frame__em:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 10px; border-radius: 50%; }
.totem__disc { -webkit-tap-highlight-color: transparent; }

/* ---------- Clearing: the wave field ---------- */
.clearing {
  --pitch: 14px;
  position: relative; height: 100svh; min-height: 34rem; overflow: clip;
}
.field {
  position: absolute; left: calc(var(--bleed) * -1); top: calc(var(--bleed) * -1);
  width: calc(100% + var(--bleed) * 2); height: calc(100% + var(--bleed) * 2); /* past the clearing (it clips): the blur never fades at an edge */
  max-width: none; cursor: crosshair; touch-action: pan-y; /* (base.css caps media at 100 %) */
  filter: blur(var(--glass-blur)) contrast(var(--glass-contrast)); /* (ink only: nothing to desaturate) */
}
/* the milky glass over the field (Kilian, 2026-10-26, his values from the dev sliders, ?dev): the canvas itself is
   blurred (over a flat ground the same picture as a backdrop blur, about a third cheaper, and the ground keeps its tone
   without correction); this layer over it and under the words is the milk */
.clearing { --glass-blur: 12px; --glass-milk: 4%; --glass-contrast: 1.05; --bleed: calc(var(--glass-blur) * 2 + 2px); }
.field-glass { position: absolute; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--ground) var(--glass-milk), transparent); }
.clearing__words { position: absolute; left: var(--gutter); bottom: clamp(2rem, 7vh, 4.5rem); max-width: min(46rem, 70vw); pointer-events: none; }
.statement {
  font-family: var(--f-voice); font-weight: 300; font-size: var(--t-statement);
  line-height: 1.02; letter-spacing: -0.022em; margin-left: -0.04em;
  font-optical-sizing: auto;
}
.clearing__sub { margin-top: 1.4rem; max-width: 34ch; font-size: 0.9375rem; color: var(--muted); }
.hint { position: absolute; right: var(--gutter); bottom: clamp(2rem, 7vh, 4.5rem); font-size: var(--t-ui); color: var(--muted); pointer-events: none; }

/* ---------- Stands: each a stage of one or more frames ---------- */
.stand { position: relative; }
.stand__stage { position: relative; height: 100svh; min-height: 36rem; overflow: clip; }
.motion .frame { position: absolute; inset: 0; }
.frame { position: relative; height: 100svh; min-height: 36rem; }

.frame__em {
  position: absolute; left: 50%; top: calc(var(--h) * 100%);
  width: var(--em); aspect-ratio: 1; translate: -50% -50%;
  color: var(--ink);
}
.frame__text {
  position: absolute; top: calc(var(--h) * 100%); translate: 0 -50%;
  width: calc(50% - var(--em) / 2 - clamp(1.5rem, 4vw, 4.5rem) - var(--gutter));
  container-type: inline-size;
}
.stand--r .frame__text { left: calc(50% + var(--em) / 2 + clamp(1.5rem, 4vw, 4.5rem)); }
.stand--l .frame__text { right: calc(50% + var(--em) / 2 + clamp(1.5rem, 4vw, 4.5rem)); text-align: right; }
.stand--l .data { justify-content: flex-end; }

/* contrast: the title is the image (as large as its longest word allows), the line is quiet and small */
.frame__title { font-family: var(--f-voice); font-weight: 300; font-size: min(5.8rem, calc(100cqi / (var(--lw, 8) * 0.6))); line-height: 0.96; letter-spacing: -0.03em; }
.frame:not(.frame--lead) .frame__title { font-size: calc(var(--t-title) * 0.86); }
.frame__title a, .totem__name {
  background: linear-gradient(currentColor, currentColor) no-repeat;
  background-size: 0% 1px; background-position: 0 100%;
  transition: background-size 0.7s var(--settle);
}
/* Literata's glyph box reaches 0.31 em below the baseline while title lines are 0.96 em apart: an underline at the
   box's bottom would lie on the next line. Lifted to sit just under the letters. */
.frame__title a { background-position: 0 calc(100% - 0.22em); }
.stand--l .frame__title a { background-position: 100% calc(100% - 0.22em); }
.frame__title a:focus-visible, .totem__name:focus-visible { background-size: 100% 1px; }
@media (hover: hover) { .frame__title a:hover, .totem__name:hover { background-size: 100% 1px; } }
.frame__line { margin-top: calc(2.6rem + 1px); max-width: 40ch; font-size: 0.875rem; line-height: 1.6; color: var(--muted); } /* the rule is gone (Kilian), its space stays */
.stand--l .frame__line { margin-left: auto; }
/* justified (Kilian), whole words only: no hyphenation (a compound may still break at its own hyphen); the last line
   always starts on the left. 40ch (was 36): with whole words the widest gap halves (DE 2.3 → 1.1 em, EN 2.0 → 1.2 em) */
.frame__line { text-align: justify; text-align-last: left; -webkit-hyphens: manual; hyphens: manual; text-wrap: wrap; } /* (the site's `pretty` widens the gaps of a justified column) */

/* Without motion (no JS, reduced motion): every frame is its own screen in its own flat colour. */
html:not(.motion) .stand__stage { height: auto; min-height: 0; overflow: visible; }
html:not(.motion) .frame[data-world="bolivia"] { --ground: var(--w-bolivia); }
html:not(.motion) .frame[data-world="colombia"] { --ground: var(--w-colombia); --ink: var(--paper); }
html:not(.motion) .frame[data-world="berlin"] { --ground: var(--w-berlin); }
html:not(.motion) .frame[data-world="betlem"] { --ground: var(--w-betlem); }
html:not(.motion) .frame:not([data-world="paper"]) {
  --mix: 92%; --muted: color-mix(in srgb, var(--ink) var(--mix), var(--ground));
  background: var(--ground); color: var(--ink);
}

/* ---------- Totem: every entry; names alternate sides of the column, like labels on a pole ---------- */
.totem {
  position: relative; min-height: calc(100svh - var(--foot-h, 9rem)); padding: 5rem var(--gutter) 1rem; display: grid; align-content: center;
  --row: clamp(1.6rem, calc((100svh - var(--foot-h, 9rem) - 6.5rem) / 9.2), 4.6rem); /* every row fits between the header and the footer */
}
.totem__list { display: grid; justify-content: center; gap: calc(var(--row) * 0.15); }
.totem__row {
  display: grid; grid-template-columns: minmax(6rem, 1fr) var(--row) minmax(6rem, 1fr);
  gap: clamp(1rem, 2.4vw, 2.2rem); align-items: center;
  width: min(60rem, calc(100vw - var(--gutter) * 2)); /* room for the longest name on one line, where the screen allows */
}
.totem__disc { grid-column: 2; grid-row: 1; position: relative; display: block; width: 100%; min-width: 0; aspect-ratio: 1; color: var(--ink); }
.totem__row--r .totem__name { grid-column: 3; grid-row: 1; justify-self: start; }
.totem__row--l .totem__name { grid-column: 1; grid-row: 1; justify-self: end; text-align: right; background-position: 100% 100%; }
.totem__name { display: inline-block; padding: 0.22rem 0; font-family: var(--f-voice); font-weight: 300; font-size: clamp(1rem, calc(var(--row) * 0.42), 1.6rem); line-height: 1.2; }
.chip { display: inline-block; width: 0.85rem; height: 0.85rem; flex: none; }
[data-world="bolivia"] > a > .chip { color: var(--w-bolivia); }
[data-world="colombia"] > a > .chip { color: var(--w-colombia); }
[data-world="berlin"] > a > .chip { color: var(--w-berlin); }
[data-world="betlem"] > a > .chip { color: var(--w-betlem); }
[data-world="paper"] > a > .chip { color: var(--ink); }

/* ---------- Phone: composed for 390 px ---------- */
@media (max-width: 760px) {
  :root { --em: 60vw; }
  .clearing__words { max-width: none; right: var(--gutter); bottom: 4.6rem; }
  .hint { left: var(--gutter); right: auto; bottom: 1.6rem; }
  .frame__em { top: calc(9svh + var(--em) / 2 + var(--h) * 14svh); }
  .frame__text, .stand--l .frame__text, .stand--r .frame__text {
    left: var(--gutter); right: var(--gutter); width: auto; translate: none; text-align: center;
    top: calc(9svh + var(--em) + var(--h) * 14svh + 2.2rem);
  }
  .stand--l .data, .data { justify-content: center; }
  .frame__line, .stand--l .frame__line { margin-inline: auto; text-align: justify; }
  .frame__title a, .stand--l .frame__title a { background-position: 50% calc(100% - 0.22em); }
  .totem { padding-top: 5.8rem; --row: clamp(1.6rem, calc((100svh - var(--foot-h, 9rem) - 8rem) / 9.8), 3.4rem); } /* names may wrap: rows a little smaller */
  .totem__row { grid-template-columns: 1fr var(--row) 1fr; gap: 0.9rem; }
  .totem__name { font-size: clamp(0.95rem, calc(var(--row) * 0.36), 1.05rem); }
}
