/* The experiments (website/scripts/seo/experiments.mjs), inside the shared frame after website/server/pages.css and
   text-pages.css: build-seo.mjs serves this as /assets/experiments.css. A scene's stage is as large as the window
   allows at 16:9 and never taller than the window. */
main.wide:has(.experiments) {
  max-width: 1320px;
}
main.wide:has(.experiment) {
  max-width: clamp(720px, calc((100vh - 220px) * 16 / 9), 1760px);
  padding-block-start: var(--pui-space-6);
}
.experiment {
  gap: var(--pui-space-4);
}
.experiment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--pui-space-1) var(--pui-space-4);
}
.experiment-head .text-title {
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.experiments,
.experiment {
  display: grid;
  gap: var(--pui-space-6);
  min-width: 0;
}
.experiment-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--pui-radius-panel);
  background: #000 center / cover no-repeat;
  box-shadow: 0 0 0 1px var(--pui-line);
}
.experiment-stage iframe {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1920px;
  height: 1080px;
  border: 0;
  transform-origin: 0 0;
  /* a finger on the scene plays it: it does not scroll the page */
  touch-action: none;
  /* the stage's picture shows until the scene can be drawn (STAGE_SCRIPT sets data-ready) */
  opacity: 0;
  transition: opacity 0.25s ease-out;
}
.experiment-stage[data-ready] iframe {
  opacity: 1;
}
/* until then the picture is plainly a picture: out of focus and dimmed, under a sign that the scene is on its way */
.experiment-stage::before {
  position: absolute;
  inset: -24px;
  background: inherit;
  filter: blur(14px) brightness(0.5) saturate(0.9);
  content: "";
}
.experiment-loading {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  display: inline-flex;
  align-items: center;
  gap: var(--pui-space-3);
  margin: 0;
  padding: var(--pui-space-3) var(--pui-space-5);
  border-radius: var(--pui-radius-pill);
  background: rgb(10 11 14 / 0.72);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: var(--pui-text-sm);
  font-weight: 500;
  translate: -50% -50%;
  transition: opacity 0.2s ease-out;
}
.experiment-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 0.25);
  border-block-start-color: #fff;
  border-radius: 50%;
  animation: experiment-spin 0.8s linear infinite;
}
.experiment-stage[data-ready] .experiment-loading {
  opacity: 0;
  pointer-events: none;
}
.experiment-stage[data-ready] .experiment-spinner {
  animation: none;
}
@keyframes experiment-spin {
  to {
    rotate: 1turn;
  }
}
.experiment-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  background-color: #000;
  background-image: none !important;
}
/* where the browser has no full screen (an iPhone), the stage fills the window instead */
.experiment-stage[data-fill] {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100vw;
  height: 100dvh;
  aspect-ratio: auto;
  border-radius: 0;
  background-color: #000;
  background-image: none !important;
}
.experiment-fill-close {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  z-index: 2;
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgb(10 11 14 / 0.72);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.18);
  color: #fff;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.experiment-stage[data-fill] .experiment-fill-close {
  display: block;
}
.experiment-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--pui-space-4);
}
.experiment-bar {
  align-items: start;
  margin-block-end: var(--pui-space-2);
}
.experiment-words {
  display: grid;
  flex: 1 1 28ch;
  gap: var(--pui-space-2);
}
.experiment-words .lead,
.experiment-try {
  font-size: var(--pui-text-lg);
  line-height: 1.5;
}
.experiment-try .muted {
  font-size: var(--pui-text-sm);
}
.experiment-tools {
  margin: 0;
}
.experiment-more {
  font-size: var(--pui-text-lg);
  font-weight: 600;
}
.experiment-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--pui-space-3);
}
.experiment-steps a {
  display: grid;
  gap: var(--pui-space-1);
  padding: var(--pui-space-4);
  border-radius: var(--pui-radius-panel);
  box-shadow: inset 0 0 0 1px var(--pui-line);
  color: var(--pui-ink);
  font-weight: 500;
}
.experiment-steps a:nth-child(2) {
  text-align: center;
}
.experiment-steps a:nth-child(3) {
  text-align: end;
}
.experiment-steps a:hover {
  background: var(--pui-surface);
}
/* a phone held upright shows the 16:9 stage a few centimetres tall: say what helps */
.experiment-phone {
  display: none;
  margin: 0;
  padding: var(--pui-space-3) var(--pui-space-4);
  border-radius: var(--pui-radius-panel);
  box-shadow: inset 0 0 0 1px var(--pui-line);
  color: var(--pui-ink-2);
  font-size: var(--pui-text-sm);
}
.experiment-phone .go {
  flex: none;
  height: 36px;
}
.experiment-phone .go[hidden] {
  display: none;
}
@media (max-width: 700px) and (orientation: portrait) {
  .experiment-phone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--pui-space-3);
  }
}
/* a phone on its side: the whole stage fits the screen's height, with a strip left above and below to scroll by */
@media (max-height: 520px) and (orientation: landscape) {
  main.wide:has(.experiment) {
    max-width: calc((100dvh - 48px) * 16 / 9);
    padding-block-start: var(--pui-space-2);
  }
}
/* the real one: the Beamline component the joke is about, right under the joke */
.experiment-real,
.experiment-band {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: var(--pui-space-8);
  padding: var(--pui-space-6);
}
.experiment-real:not(:has(.experiment-real-picture)) {
  grid-template-columns: minmax(0, 1fr);
}
.experiment-real-picture {
  display: block;
  overflow: hidden;
  border-radius: calc(var(--pui-radius-panel) - 4px);
  box-shadow: 0 0 0 1px var(--pui-line);
}
.experiment-real-picture img {
  display: block;
  width: 100%;
  height: auto;
  transition: scale 0.25s ease-out;
}
.experiment-real-picture:hover img {
  scale: 1.03;
}
.experiment-real-words {
  display: grid;
  gap: var(--pui-space-3);
  min-width: 0;
}
.experiment-real-words h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pui-space-3);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.experiment-real-words .muted {
  max-width: 62ch;
  font-size: var(--pui-text-lg);
  line-height: 1.5;
}
.experiment-tag {
  padding: 3px var(--pui-space-3);
  border-radius: var(--pui-radius-pill);
  box-shadow: inset 0 0 0 1px var(--pui-line);
  color: var(--pui-ink-2);
  font-size: var(--pui-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.experiment-tag[data-free] {
  box-shadow: none;
  background: color-mix(in oklab, var(--pui-success, #2fbf71) 22%, transparent);
  color: var(--pui-success, #2fbf71);
}
.experiment-real-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pui-space-3);
  margin-block-start: var(--pui-space-2);
}
/* the index's band sits in the grid of cards, across all of it */
.experiment-band {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  overflow: hidden;
  padding-block: var(--pui-space-8);
}
.experiment-band-screens {
  display: flex;
  justify-content: center;
  height: 300px;
  margin-block: calc(var(--pui-space-8) * -1);
  padding-block-start: var(--pui-space-6);
}
.experiment-band-screens img {
  width: 232px;
  height: auto;
  flex: none;
  align-self: start;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--pui-line),
    0 24px 60px rgb(0 0 0 / 0.5);
}
.experiment-band-screens img:nth-child(1) {
  rotate: -5deg;
  translate: 24px 26px;
}
.experiment-band-screens img:nth-child(2) {
  z-index: 1;
}
.experiment-band-screens img:nth-child(3) {
  rotate: 5deg;
  translate: -24px 26px;
}
/* the line that names the real one, after someone has played for a while (STAGE_SCRIPT) */
.experiment-nudge {
  position: fixed;
  inset-block-end: var(--pui-space-6);
  inset-inline-end: var(--pui-space-6);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--pui-space-4);
  max-width: min(640px, calc(100vw - 32px));
  padding: var(--pui-space-4) var(--pui-space-3) var(--pui-space-4) var(--pui-space-5);
  border-radius: var(--pui-radius-panel);
  box-shadow:
    0 0 0 1px var(--pui-line),
    0 20px 50px rgb(0 0 0 / 0.55);
  /* it lands over a scene of any colour: a surface of its own, not the page's see-through one */
  background: color-mix(in oklab, var(--pui-page) 88%, white);
  animation: experiment-nudge 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.experiment-nudge p {
  display: grid;
  gap: 2px;
  margin: 0;
}
.experiment-nudge b {
  font-size: var(--pui-text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.experiment-nudge p > span {
  color: var(--pui-ink-2);
  font-size: var(--pui-text-sm);
}
.experiment-nudge .experiment-tag {
  margin-inline-start: var(--pui-space-1);
  padding: 1px var(--pui-space-2);
}
.experiment-nudge[hidden] {
  display: none;
}
.experiment-nudge .go {
  flex: none;
  height: var(--pui-control-height-md, 36px);
}
.experiment-nudge-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--pui-ink-3);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.experiment-nudge-close:hover {
  color: var(--pui-ink);
}
@keyframes experiment-nudge {
  from {
    opacity: 0;
    translate: 0 28px;
    rotate: 2deg;
  }
}
/* the header and the footer are as wide as the page between them, and the header's links sit level with its buttons */
body:has(.experiments) :is(.top, .foot) {
  width: min(1320px, 100%);
}
body:has(.experiment) :is(.top, .foot) {
  width: min(clamp(720px, calc((100vh - 220px) * 16 / 9), 1760px), 100%);
}
body:has(.experiment, .experiments) .top nav {
  align-items: center;
}
/* arriving from a clip, the two ways in stay in the header on a wide screen too */
@media (min-width: 641px) {
  body:has(.experiment, .experiments) .top nav .top-cta {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding-inline: 12px;
    border-radius: 10px;
    background: var(--pui-surface);
    box-shadow: inset 0 0 0 1px var(--pui-line);
    color: var(--pui-ink);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
  }
  body:has(.experiment, .experiments) .top nav .top-buy {
    background: var(--pui-ink);
    box-shadow: none;
    color: var(--pui-page);
  }
}
/* the page's closing product line stays, as fine print */
main:has(.experiment, .experiments) > .beamline-context {
  margin-block: var(--pui-space-10) 0;
  color: var(--pui-ink-3);
  font-size: var(--pui-text-xs);
  text-align: center;
}
main:has(.experiment, .experiments) > .beamline-context a {
  color: inherit;
  text-decoration: none;
}
main:has(.experiment, .experiments) > .beamline-context a:hover {
  color: var(--pui-ink-2);
}
@media (max-width: 860px) {
  .experiment-real,
  .experiment-band {
    grid-template-columns: minmax(0, 1fr);
  }
  .experiment-band-screens {
    display: none;
  }
}
.experiment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--pui-space-4);
}
.experiment-card {
  display: grid;
  overflow: hidden;
  border-radius: var(--pui-radius-panel);
  color: var(--pui-ink);
  transition: translate 0.15s ease-out;
}
.experiment-card:hover {
  translate: 0 -2px;
}
.experiment-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.experiment-card-text {
  display: grid;
  gap: 2px;
  padding: var(--pui-space-3) var(--pui-space-4) var(--pui-space-4);
}
@media (prefers-reduced-motion: reduce) {
  .experiment-card,
  .experiment-stage iframe,
  .experiment-loading,
  .experiment-real-picture img {
    transition: none;
  }
  .experiment-nudge {
    animation: none;
  }
  .experiment-spinner {
    animation: none;
  }
}
