/* Totemphonia v2 · GEMS. Kilian: panorama, the whole triptych across one screen; text and works below; paper;
   SoundCloud kept; the v1 LED animation unchanged (assets/js/gems.js). */

[data-world="bolivia"] { --c: var(--w-bolivia); }
[data-world="colombia"] { --c: var(--w-colombia); }
[data-world="berlin"] { --c: var(--w-berlin); } /* sandstein II wears the Berlin emblem and green (Kilian) */
[data-world="paper"] { --c: var(--ink); }

.gems {
  --hdr: 4.25rem;
  --ar: 2.8665; /* GEMS10.svg viewBox 5404.475 × 1885.423 */
  /* the panorama fills the width, unless the window is too short: then it fits the screen with its caption */
  --fig-w: min(100vw - var(--gutter) * 2, (100svh - var(--hdr) - 9.5rem) * var(--ar));
  --cols: repeat(12, minmax(0, 1fr));
}

/* ---------- Screen 1: the triptych, its caption right under it like a wall label; the pair centred ---------- */
.gems__hero {
  min-height: 100svh; display: grid; grid-template-rows: var(--hdr) 1fr auto auto 1.15fr;
  justify-items: center; padding: 0 var(--gutter);
}
.gems__fig { grid-row: 3; width: var(--fig-w); }
.gems__cap {
  grid-row: 4; width: var(--fig-w);
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem 2rem; flex-wrap: wrap;
  padding-top: clamp(1.25rem, 3.5svh, 2.25rem);
}
.gems__title { font-family: var(--f-voice); font-weight: 300; font-size: var(--t-title); line-height: 1; letter-spacing: -0.02em; margin-left: -0.04em; }
.gems__expand { font-family: var(--f-voice); font-weight: 300; font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.4rem); color: var(--muted); letter-spacing: -0.005em; }

/* the slot reserves the triptych's exact shape before the SVG arrives: nothing moves when it does */
#svgSlot { position: relative; aspect-ratio: 5404.475 / 1885.423; }
@media (orientation: portrait) { #svgSlot { aspect-ratio: 1871 / 5553.062; } }
#svgSlot .svg-ph { width: 100%; aspect-ratio: var(--svg-ar, 1000 / 1400); }
.led-panel svg { width: 100%; height: auto; display: block; }
/* v1: the SVG appears only once it is complete, then fades in */
#svgSlot svg { opacity: 0; }
#svgSlot.is-ready svg { opacity: 1; transition: opacity 1000ms ease-in; }

/* v1 LED colours and classes (read by gems.js) */
:root { --led-on: #CECECE; --led-off: #1E1E1E; --led-fade-ms: 30; }
.led-dot { fill: var(--led-off); transition: fill var(--led-fade-ms)ms linear; }
.led-dot.on { fill: var(--led-on); }
.led-node { fill: var(--led-off); transition: fill var(--led-fade-ms)ms linear; }
.led-node.on { fill: var(--led-on); }

/* ---------- The text and the works share one axis: column 5 ---------- */
.gems__about, .work { display: grid; grid-template-columns: var(--cols); gap: 0 var(--gutter); padding: 0 var(--gutter); }
.gems__about { margin-top: clamp(5rem, 16svh, 10rem); }
.gems__about p { grid-column: 5 / span 7; max-width: 60ch; font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem); line-height: 1.6; }

.gems__works { display: grid; gap: clamp(4.5rem, 13svh, 8.5rem); margin-top: clamp(6rem, 18svh, 11rem); }
.work { align-items: start; scroll-margin-top: calc(var(--hdr) + 2rem); }
.work__head { grid-column: 1 / span 4; display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center; }
.work__em { width: clamp(3rem, 2.4rem + 1.6vw, 4.25rem); height: auto; aspect-ratio: 1; fill: currentColor; color: var(--c); transition: scale 0.9s var(--settle); }
@media (hover: hover) { .work:hover .work__em { scale: 1.06; } }
.work__title { font-family: var(--f-voice); font-weight: 300; font-style: italic; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.5rem); line-height: 1.05; letter-spacing: -0.015em; }
.work__body { grid-column: 5 / span 7; max-width: 60ch; }
.work__body p { line-height: 1.6; }
/* SoundCloud, as in v1: the visual player, its height following its width */
.work__player { margin-top: clamp(1.4rem, 3svh, 2rem); container-type: inline-size; }
.work__player iframe { display: block; width: 100%; height: clamp(150px, 100cqi / 3.2, 210px); border: 0; }
/* before the click: the player's place, a play and a word on why (nothing reaches SoundCloud before) */
.work__player[data-embed]:not(.is-live) { min-height: clamp(150px, 100cqi / 3.2, 210px); display: grid; align-content: center; justify-items: start; gap: 0.7rem; padding: 1.2rem 1.4rem; border: 1px solid var(--line); }
.work__load { display: inline-flex; align-items: center; gap: 0.8rem; font-weight: 500; }
.work__load-i { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid currentColor; transition: background-color 0.3s, color 0.3s; }
.work__load-i::before { content: ''; border-style: solid; border-width: 0.4rem 0 0.4rem 0.66rem; border-color: transparent transparent transparent currentColor; margin-left: 0.15rem; }
.work__load:focus-visible .work__load-i { background: var(--ink); color: var(--ground); }
@media (hover: hover) { .work__load:hover .work__load-i { background: var(--ink); color: var(--ground); } }
.work__load-note { font-size: var(--t-ui); color: var(--muted); }

/* ---------- Coda: v1's closing sentence ---------- */
.gems__coda {
  margin: clamp(8rem, 26svh, 15rem) 0 clamp(4rem, 12svh, 8rem); padding: 0 var(--gutter);
  font-family: var(--f-voice); font-weight: 300; font-size: var(--t-statement); line-height: 1.02; letter-spacing: -0.025em;
  max-width: 17ch; margin-left: -0.04em; text-wrap: balance;
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .work__head { grid-column: 1 / span 12; margin-bottom: 1.6rem; }
  .gems__about p, .work__body { grid-column: 1 / span 11; }
}

/* ---------- Phone / portrait: v1 shows the stacked triptych; the caption comes first ---------- */
@media (orientation: portrait), (max-width: 760px) {
  .gems { --fig-w: calc(100vw - var(--gutter) * 2); }
  .gems__hero { min-height: 0; grid-template-rows: var(--hdr) auto auto; }
  .gems__hero > * { align-self: start; }
  .gems__cap { grid-row: 2; padding: clamp(2rem, 6svh, 3.5rem) 0 clamp(1.5rem, 4svh, 2.5rem); }
  .gems__fig { grid-row: 3; }
}
@media (max-width: 760px) {
  .gems__about p, .work__body { grid-column: 1 / -1; }
  .gems__expand { font-size: 1.05rem; }
}
