/* Shared controls stay visible while their scenes can be moved, darkened or shattered. */
.experiment-shell {
  padding-block: clamp(2rem, 5vw, 5rem) 3.5rem;
}

.experiment-heading {
  margin-block-end: 1.3rem;
}

.experiment-heading h1 {
  font-size: clamp(3.4rem, 8vw, 8rem);
  margin-block: .55rem;
}

.experiment-back {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .24em;
  font-size: .92rem;
  font-weight: 700;
}

.fx-controls,
.experiment-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}

.fx-controls {
  position: relative;
  z-index: 16;
  margin-block-end: .7rem;
}

.fx-status {
  color: var(--muted);
  font-size: .88rem;
  min-width: 0;
}

.fx-caption {
  color: var(--muted);
  margin-block: .8rem 1.15rem;
  font-size: .92rem;
}

.experiment-nav {
  border-block-start: 1px solid var(--line);
  padding-block-start: 1rem;
  margin-block-start: 1.15rem;
}

.experiment-nav a {
  font-size: .86rem;
  padding: .25rem .55rem;
  border-radius: .35rem;
  border: 1px solid var(--line);
}

.experiment-nav a[aria-current],
.experiment-nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.experiment-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .68rem;
}

.experiment-card {
  --card: #80eacf;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-height: 12rem;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: .85rem;
  border-radius: .45rem;
  transition: transform .24s, border-color .24s;
}

.experiment-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.experiment-card strong {
  line-height: 1.25;
}

.experiment-card span:last-child {
  font-size: .85rem;
  line-height: 1.4;
  color: var(--muted);
}

.experiment-icon {
  width: 2.05rem;
  height: 2.05rem;
  background: var(--card);
  display: block;
  margin-block-end: .25rem;
}

.ex-gravity .experiment-icon { clip-path: polygon(50% 0, 100% 75%, 85% 100%, 15% 100%, 0 75%); }
.ex-runaway .experiment-icon { --card: #ffb288; clip-path: polygon(11% 10%, 98% 44%, 63% 59%, 46% 96%, 30% 64%); }
.ex-darkroom .experiment-icon { --card: #ffe6a3; border-radius: 50%; box-shadow: 0 0 25px #ffc96361; }
.ex-blast .experiment-icon { --card: #ffa47e; clip-path: polygon(49% 0, 63% 24%, 90% 10%, 84% 43%, 100% 50%, 75% 63%, 80% 88%, 57% 77%, 47% 100%, 34% 78%, 7% 89%, 22% 60%, 0 49%, 25% 36%, 16% 10%, 38% 24%); }
.ex-river .experiment-icon { --card: #8ed8ff; clip-path: polygon(0 17%, 25% 6%, 47% 32%, 69% 47%, 100% 32%, 100% 65%, 72% 84%, 47% 67%, 25% 45%, 0 58%); }

body[data-experiment=gravity] {
  --page-font: var(--display);
  --heading-track: -.055em;
  --accent: #b4f8e9;
  --fx: 180,248,233;
}

body[data-experiment=runaway] {
  --page-font: var(--display);
  --heading-track: -.055em;
  --bg: #211410;
  --panel: #301d16;
  --ink: #fff0e1;
  --line: #744b3a;
  --muted: #e5c7b9;
  --header: #211410ed;
  --accent: #ffb38c;
  --on: #36190e;
  --fx: 255,179,140;
}

body[data-experiment=darkroom] {
  --page-font: var(--serif);
  --heading-track: -.065em;
  --bg: #171210;
  --panel: #2a2016;
  --ink: #fff3dc;
  --line: #66533e;
  --muted: #e1ceb2;
  --header: #171210ed;
  --accent: #ffdd98;
  --on: #2d1a0b;
  --fx: 255,221,152;
}

body[data-experiment=darkroom] h1 {
  font-style: italic;
  font-weight: 400;
}

body[data-experiment=blast] {
  --page-font: var(--display);
  --heading-track: -.06em;
  --bg: #231214;
  --panel: #371b21;
  --ink: #fff0e6;
  --line: #82484b;
  --muted: #e9c0b7;
  --header: #231214ed;
  --accent: #ff976e;
  --on: #36170c;
  --fx: 255,151,110;
}

body[data-experiment=river] {
  --page-font: var(--serif);
  --heading-track: -.06em;
  --bg: #081a26;
  --panel: #102a36;
  --ink: #effaff;
  --line: #3e6574;
  --muted: #c3dce7;
  --header: #081a26ed;
  --accent: #a4e6ff;
  --on: #0d2836;
  --fx: 164,230,255;
}

body[data-experiment=river] h1 {
  font-style: italic;
  font-weight: 400;
}

.fx-stage {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: .72rem;
  overflow: clip;
  min-width: 0;
  height: clamp(20rem, 43vw, 34rem);
}

.gravity-stage {
  color: #e3fff6;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, #295049 0%, #102b2a 38%, #091a1b 80%);
}

.gravity-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(#a6f5c81c 1px, transparent 1px) center / 2rem 2rem,
    linear-gradient(90deg, #a6f5c81c 1px, transparent 1px) center / 2rem 2rem;
  mask-image: radial-gradient(ellipse at center, #000a, transparent 77%);
  pointer-events: none;
}

.gravity-orbit,
.gravity-core {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  border-radius: 50%;
}

.gravity-orbit {
  width: min(77%, 38rem);
  aspect-ratio: 1.85;
  rotate: -19deg;
  border: 1px solid #6bbab680;
}

.gravity-orbit > i {
  position: absolute;
  inset: 12%;
  border: 1px solid #71c8af68;
  border-radius: 50%;
}

.gravity-orbit > i:last-child { inset: 25%; }

.gravity-core {
  width: clamp(8rem, 22vw, 17rem);
  aspect-ratio: 1;
  border: 1px solid #8ff7db86;
  background: radial-gradient(circle at 34% 31%, #b7ffe84a, #1b453b6b 38%, #061716b5 74%);
  box-shadow: 0 0 58px #62ecd249, inset 0 0 28px #b4f8e93a;
  transition: scale .5s, box-shadow .5s;
}

.gravity-stage.is-floating .gravity-core {
  scale: 1.12;
  box-shadow: 0 0 85px #62ecd270, inset 0 0 45px #b4f8e93a;
}

.gravity-grid,
.runaway-grid {
  position: relative;
  display: grid;
  justify-content: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  width: min(calc(100% - 2rem), 21rem);
}

.gravity-object,
.runaway-object {
  position: relative;
  z-index: 1;
  display: flex;
  gap: .5rem;
  align-items: center;
  color: inherit;
  min-width: 0;
  padding: .62rem .72rem;
  border-radius: .4rem;
  border: 1px solid #7aa99e;
  background: #122927ee;
  box-shadow: 0 8px 24px #0004;
  translate: var(--tx, 0px) var(--ty, 0px);
  rotate: var(--rotation, 0deg);
}

.gravity-object strong,
.runaway-object strong {
  min-width: 0;
  line-height: 1.22;
}

.gravity-object {
  will-change: transform;
  transition: background .28s;
}

.gravity-stage.is-floating .gravity-object {
  background: #225249f5;
}

.fx-object-icon {
  width: .74rem;
  height: .74rem;
  flex: none;
  background: var(--piece, #a7ffe8);
  rotate: 45deg;
  border-radius: .075rem;
}

.gravity-object:nth-child(2) { --piece: #91caff; }
.gravity-object:nth-child(3) { --piece: #efe2a8; }
.gravity-object:nth-child(4) { --piece: #d4bcfa; }

.runaway-stage {
  color: #ffe4c9;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(0deg, #e7825420 0 1px, transparent 1px 3rem),
    repeating-linear-gradient(90deg, #e7825420 0 1px, transparent 1px 3rem),
    radial-gradient(ellipse at center, #633123, #261510 79%);
}

.runaway-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(calc(100% - 2rem), 29rem);
}

.runaway-object {
  font-family: var(--display);
  font-size: clamp(1.25rem, 3.8vw, 2.45rem);
  padding: .65rem .89rem;
  background: #3c2019;
  border-color: #9c5946;
  will-change: transform;
  transition: translate .32s cubic-bezier(.16,.85,.35,1.24), rotate .32s ease, background .22s;
}

.runaway-object .fx-object-icon {
  --piece: #ffc0a1;
  border-radius: 50%;
}

.runaway-object:nth-child(5) {
  grid-column: 1 / -1;
  justify-self: center;
}

.runaway-object.is-away {
  background: #7c3a24;
}

.dark-stage {
  min-height: 21rem;
  background: #17120f;
  color: #fff0d8;
  --torch-x: 49%;
  --torch-y: 38%;
  --torch-radius: clamp(5rem, 15vw, 9.25rem);
  cursor: crosshair;
}

.dark-stage > img,
.river-stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dark-stage > img {
  filter: brightness(.86) saturate(.81);
}

.dark-panels {
  position: absolute;
  inset: auto 0 9%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 1rem;
  padding-inline: 5%;
}

.dark-note {
  min-width: 0;
  color: #fff2dc;
  background: #201711e8;
  padding: .7rem .85rem;
  border: 1px solid #aa8154;
  border-radius: .35rem;
}

.dark-note strong {
  font-size: clamp(1rem, 2.45vw, 1.85rem);
}

.dark-note p {
  color: #ead6b8;
  font-size: .86rem;
}

.dark-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at var(--torch-x) var(--torch-y),
    transparent 0 calc(var(--torch-radius) * .56),
    #140e088a calc(var(--torch-radius) * .83),
    #080608f9 var(--torch-radius), #060507 100%);
  transition: opacity .21s ease;
}

.dark-stage.is-lit .dark-mask {
  opacity: 0;
}

.torch-marker {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  width: .68rem;
  height: .68rem;
  left: var(--torch-x);
  top: var(--torch-y);
  translate: -50% -50%;
  border: 1px solid #fff4cc;
  border-radius: 50%;
  opacity: .74;
}

.dark-stage.is-lit .torch-marker { opacity: 0; }

.pointer-active .dark-stage { cursor: crosshair; }
html[data-native-pointer] #cursor,
html[data-native-pointer] #trail { display: none; }
html[data-native-pointer] { cursor: auto; }

.blast-stage {
  color: #ffe5d4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .85rem;
  background: repeating-linear-gradient(142deg, #ffc89c0b 0 2px, transparent 2px 31px),
    radial-gradient(ellipse at 55% 37%, #68332c, #2e151a 70%);
}

.blast-brand {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(3, 1fr);
  gap: .16rem;
  width: clamp(4.2rem, 12vw, 9rem);
  aspect-ratio: 1.3;
  transform: skewX(-14deg);
}

.blast-brand span {
  height: 55%;
  background: #ff9871;
  border-radius: .13rem;
  box-shadow: 0 0 24px #fa885d65;
}

.blast-brand span:nth-child(2) { height: 100%; background: #ffd4af; }
.blast-brand span:nth-child(3) { height: 70%; }

.blast-message {
  text-align: center;
  padding-inline: .8rem;
}

.blast-message strong {
  font: 700 clamp(2.25rem, 7vw, 6.7rem)/.9 var(--display);
  letter-spacing: -.045em;
}

.blast-message p {
  margin-block-start: .6rem;
  color: #ffcebb;
}

.blast-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
  padding-inline: .8rem;
}

.blast-chips span {
  border: 1px solid #de9676;
  border-radius: .25rem;
  padding: .25rem .55rem;
  text-align: center;
  font-size: .8rem;
}

.is-shattered [data-blastable] {
  visibility: hidden;
}

.is-shattered header.top {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
}

.is-shattered .reading-bar { display: none; }

.blast-layer {
  position: fixed;
  inset: 0;
  z-index: 12;
  overflow: clip;
  pointer-events: none;
}

.blast-fragment {
  position: absolute;
  perspective: 700px;
  overflow: visible;
  will-change: transform, opacity;
}

.blast-fragment > .blast-snapshot {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  pointer-events: none;
  overflow: hidden;
}

.blast-fragment > .top-inner {
  width: 100%;
  gap: 1rem;
  background: var(--header);
}

.blast-placeholder {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  padding: 1rem;
  color: var(--muted);
  background: repeating-linear-gradient(145deg, #f8c0ac12 0 1px, transparent 1px 1rem), var(--panel);
  border: 1px dashed var(--line);
  border-radius: .72rem;
  font-size: .9rem;
  text-align: center;
}

.is-shattered .blast-placeholder {
  display: grid;
}

.blast-wrap {
  position: relative;
}

.river-stage {
  background: #071821;
  min-height: 20rem;
  color: #dff9ff;
}

.river-stage > img {
  opacity: .58;
  filter: saturate(.75) brightness(.7);
}

.river-stage > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.river-endpoints {
  position: absolute;
  z-index: 3;
  inset: .85rem .85rem auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .25rem;
  direction: ltr;
  pointer-events: none;
}

.river-endpoints span {
  background: #061925eb;
  border: 1px solid #8ed1eb95;
  border-radius: .25rem;
  padding: .24rem .56rem;
  color: #e7faff;
  font: 700 .8rem/1.4 var(--mono);
}

.river-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.river-object {
  position: absolute;
  left: 0;
  top: 0;
  translate: calc(var(--river-x, -150px) - 50%) calc(var(--river-y, 0px) - 50%);
  display: flex;
  align-items: center;
  gap: .37rem;
  max-width: 7rem;
  padding: .33rem .46rem;
  color: #e8faff;
  background: #062334ec;
  border: 1px solid #9ce9f0;
  border-radius: 2rem;
  font-size: .82rem;
  line-height: 1.15;
  opacity: var(--river-opacity, 0);
  will-change: transform, opacity;
}

.river-object .fx-object-icon {
  --piece: #7fe4ef;
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
}

.river-words {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-block-start: .6rem;
  color: var(--muted);
  font-size: .83rem;
}

.river-words > span {
  border: 1px solid var(--line);
  padding: .16rem .53rem;
  border-radius: 2rem;
}

html:not([lang=en]) .experiment-heading h1 {
  line-height: 1.1;
  font-size: clamp(2.5rem, 7vw, 6.2rem);
}

@media (max-width: 960px) {
  .experiment-links {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }

  .fx-stage {
    height: clamp(21rem, 55vw, 33rem);
  }
}

@media (max-width: 540px) {
  .experiment-links {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .experiment-card {
    min-height: 9rem;
  }

  .dark-panels {
    gap: .25rem;
    padding-inline: .45rem;
    inset-block-end: 5%;
  }

  .dark-note {
    padding: .3rem;
  }

  .dark-note p {
    font-size: .72rem;
  }

  .runaway-grid {
    width: min(75%, 23rem);
  }

  .runaway-object {
    padding: .48rem .5rem;
  }

  .gravity-grid {
    width: min(77%, 18rem);
  }

  .gravity-object {
    padding: .45rem .5rem;
  }
}

@view-transition {
  navigation: none;
}
