/* Playground: a casual pile of polaroids (after Bimanshu), each opens a live demo (after Maria). */
.play { position: relative; background: var(--bg); padding: 40px 0 180px; }
.play-inner { width: min(100% - 64px, 1445px); margin: 0 auto; display: grid; grid-template-columns: 180px minmax(0, 1145px); gap: clamp(32px, 5vw, 120px); justify-content: center; }
.play-label { margin: 0; padding: 7px 0 0 16px; font-size: 14px; color: var(--faint); }
.play header { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 14px; }
.play h2 { margin: 0; font-family: var(--head-family); font-style: var(--head-style); font-weight: var(--head-weight); color: var(--head-color);
  font-size: clamp(26px, 2.3vw, 36px); line-height: 1.15; letter-spacing: -.01em; }
.play header span { font-size: 14px; color: var(--soft); }
.play .lede { margin: 0 0 56px; max-width: 760px; font: var(--text-font); color: var(--soft); }

.pg-pile { list-style: none; margin: 0; padding: 12px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; row-gap: 28px; }
.pg-slot { position: relative; width: clamp(122px, 10.1vw, 146px); margin: 0 -6px; transform: translateY(var(--y, 0px)) rotate(var(--r, 0deg)); }
.pg-slot:hover, .pg-slot:focus-within { z-index: 10; }
/* Stuck on: each card drops in a little big and high, then presses flat. */
.pg-float { opacity: 0; transform: translateY(-22px) scale(1.08) rotate(calc(var(--r, 0deg) * 1.6));
  transition: opacity .25s var(--ease-out), transform .55s cubic-bezier(.34, 1.36, .64, 1); transition-delay: calc(60ms + var(--i) * 90ms); }
.pg-pile.is-in .pg-float { opacity: 1; transform: none; }
.pg-polaroid { position: relative; }

/* Drag: its own wrapper so it never fights the slot rotation, entrance or hover transforms. */
.pg-drag { transition: transform .22s var(--ease-out); }
.pg-drag.is-dragging { transition: none; }
.pg-drag.is-dragging .pg-card { transform: scale(1.04) rotate(calc(var(--r, 0deg) * -.6)); cursor: grabbing; }
.pg-drag.is-dragging .pg-polaroid { box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 24px 40px -14px rgba(40,35,25,.35); }
@media (pointer: fine) { .pg-card { cursor: grab; } .pg-card img { -webkit-user-drag: none; user-select: none; } }

/* Stealth project polaroid: a confidential note, not a screenshot. */
.pg-secret { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; padding: 12%;
  background: repeating-linear-gradient(#fbf3b4 0 17px, #e9df9a 17px 18px); color: #3a3428; font: 600 13px/1.35 Inter, system-ui, sans-serif; }
.pg-secret b { justify-self: center; font-size: 11px; letter-spacing: .14em; color: #b1322a; border: 2px solid #b1322a; border-radius: 3px; padding: 3px 6px; rotate: -8deg; }

.pg-card { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; border-radius: 4px;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.pg-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.pg-polaroid { margin: 0; background: #fbfaf6; border-radius: 4px; padding: 7% 7% 0;
  box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 6px 18px -6px rgba(40,35,25,.22); }
.pg-photo { position: relative; aspect-ratio: var(--ar, 1); overflow: hidden; border-radius: 2px; background: #e9e7e1; }
.pg-photo::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); border-radius: inherit; }
.pg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-polaroid figcaption { height: calc(var(--w, 214px) * .21); min-height: 34px; display: flex; align-items: center; justify-content: center;
  font: 600 clamp(17px, 1.5vw, 21px)/1 Caveat, "Bradley Hand", cursive; color: #3d3a35; transform: rotate(-1.5deg); }
@media (hover: hover) and (pointer: fine) {
  .pg-card:hover { transform: translateY(-6px) rotate(calc(var(--r, 0deg) * -.5)); }
  .pg-card:hover .pg-polaroid { box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 16px 30px -10px rgba(40,35,25,.3); }
}
.pg-card:active { transform: scale(.97); }

/* Terminal polaroid: drawn, not a screenshot. */
.pg-term { position: absolute; inset: 0; background: #17171a; color: #c9d1c4; font: 500 clamp(8px, .7vw, 10px)/1.55 ui-monospace, "SF Mono", Menlo, monospace; padding: 11% 10%; }
.pg-term b { color: #8fd18a; font-weight: 500; }
.pg-term i { font-style: normal; display: inline-block; width: .55em; height: 1.05em; background: #c9d1c4; vertical-align: -2px; animation: pgblink 1.1s steps(1) infinite; }
@keyframes pgblink { 50% { opacity: 0; } }

/* Demo dialog. A modal, so it scales from centre. */
.pg-dialog { width: min(1080px, 100vw - 32px); height: min(760px, 100dvh - 32px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 16px;
  background: #fff; color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.35); overflow: hidden;
  opacity: 1; transform: none; transition: opacity .22s var(--ease-out), transform .22s var(--ease-out), overlay .22s allow-discrete, display .22s allow-discrete; }
.pg-dialog:not([open]) { opacity: 0; transform: scale(.96); }
@starting-style { .pg-dialog[open] { opacity: 0; transform: scale(.96); } }
.pg-dialog::backdrop { background: rgba(30,28,24,.38); backdrop-filter: blur(3px); transition: background .22s var(--ease-out), overlay .22s allow-discrete, display .22s allow-discrete; }
.pg-dialog:not([open])::backdrop { background: rgba(30,28,24,0); }
@starting-style { .pg-dialog[open]::backdrop { background: rgba(30,28,24,0); } }
.pg-shell { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.pg-bar { display: flex; align-items: center; gap: 18px; padding: 16px 18px 16px 24px; border-bottom: 1px solid #ecebe6; }
.pg-bar div { flex: 1; min-width: 0; }
.pg-bar h3 { margin: 0; font: 600 16px/1.3 Inter, system-ui, sans-serif; }
.pg-bar p { margin: 2px 0 0; font: 400 14px/1.45 Inter, system-ui, sans-serif; color: var(--soft); }
.pg-bar a, .pg-bar button { font: 500 13px Inter, system-ui, sans-serif; color: var(--ink); text-decoration: none; border: 1px solid #e3e2dd; background: #fff;
  border-radius: 999px; padding: 8px 14px; cursor: pointer; transition: transform .16s var(--ease-out), background .2s; white-space: nowrap; }
.pg-bar a:active, .pg-bar button:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .pg-bar a:hover, .pg-bar button:hover { background: #f4f4f1; } }
.pg-stage { position: relative; background: #f6f5f2; }
.pg-stage img.pg-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pg-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }

/* Live terminal inside the dialog. */
.pg-console { position: absolute; inset: 0; background: #141416; color: #d4dbcf; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, monospace; padding: 22px 26px; overflow: auto; }
.pg-console pre { margin: 0; white-space: pre-wrap; font: inherit; }
.pg-console .ln { display: flex; gap: .6em; }
.pg-console .ps { color: #8fd18a; }
.pg-console input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: inherit; font: inherit; caret-color: #8fd18a; }

@media (max-width: 1079px) {
  .play-inner { grid-template-columns: minmax(0, 1fr); }
  .play-label { display: none; }
}
@media (max-width: 700px) {
  .play { padding: 20px 0 120px; }
  .play-inner { width: calc(100% - 32px); }
  .play .lede { margin-bottom: 36px; }
  .pg-slot { width: 42vw; margin: 0 -4px; }
  .pg-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .pg-bar { flex-wrap: wrap; row-gap: 12px; }
  .pg-bar div { flex-basis: 100%; } /* title and text on their own row, buttons below */
}
@media (prefers-reduced-motion: reduce) {
  .pg-float { transform: none; transition: opacity .3s ease; transition-delay: 0s; }
  .pg-drag { transition: none; }
  .pg-card, .pg-card:hover, .pg-card:active { transform: none; transition: none; }
  .pg-dialog, .pg-dialog::backdrop { transition: none; }
  .pg-term i { animation: none; }
}

/* Mobile pass: polaroids no longer collide, 20px gutters. */
@media (max-width: 700px) {
  .play { padding: 20px 0 72px; }
  .play-inner { width: calc(100% - 40px); }
  .play .lede { font-size: 17px; line-height: 1.55; }
  .pg-pile { row-gap: 40px; }
  .pg-slot { width: 41vw; margin: 0 2px; transform: rotate(calc(var(--r, 0deg) * .7)); }
}
