/* E4 — Playground. The strip's form (Yanzi: "还是按照刚才的形式"), wrapped into rows that fill the
   page — no sideways scrolling, 3–4 columns per row. Same nav bar + line system as every page:
   nav line, the 48px label row (filters), then the rows. Each column: name at the top, tool + year
   just above the image, the image standing on the row's year line at its own ratio. */

.pg-page { animation: none; }
.bar-play.is-current { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1.5px; }

/* label row = the site's second line: filters left, count right */
.pg-label {
  display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 var(--m);
  border-bottom: 1px solid #000; font: 400 13px/1 var(--sans);
}
.pg-filters { display: flex; gap: 16px; }
.pg-filters button { font: inherit; color: #6b6b6b; padding: 0; transition: color .2s; }
.pg-filters button:hover { color: #000; }
.pg-filters button[aria-pressed="true"] { color: #000; font-weight: 500; }
.pg-count { margin-left: auto; color: #6b6b6b; font-variant-numeric: tabular-nums; }

/* rows: columns side by side on thin lines; widths follow the images */
.pg-row { display: flex; min-height: 40vw; }
.pg-col, .pg-fill { flex-basis: 0; min-width: 0; }
.pg-col {
  display: flex; flex-direction: column;
  border-right: 1px solid #000; font: 400 13px/1.3 var(--sans); color: #000;
}
.pg-row > :last-child { border-right: 0; }
.pg-fill { border-bottom: 1px solid #000; }   /* an unfinished last row still ends on the line */
.pg-name { margin: 0; padding: 10px 12px 0; font: 500 13px/1.3 var(--sans); }
.pg-meta { margin: auto 0 0; display: flex; justify-content: space-between; gap: 12px; padding: 24px 12px 8px; }
.pg-meta span:first-child { color: #6b6b6b; }
.pg-meta span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-img { margin: 0 12px; aspect-ratio: var(--r, 1.4); background: #eee; overflow: hidden; }
.pg-img > img, .pg-img > video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.pg-col:hover .pg-img > * { transform: scale(1.03); }
/* the year line along the bottom of each row (year shows at its first column in the row) */
.pg-year {
  flex: none; height: 44px; margin: 12px 0 0; display: flex; align-items: center; padding: 0 12px;
  border-top: 1px solid #000; border-bottom: 1px solid #000; font-variant-numeric: tabular-nums;
}
.pg-fill { align-self: flex-end; height: 45px; }
.pg-row:first-child .pg-col:first-child .pg-name,
.pg-row .pg-col:first-child .pg-name, .pg-row .pg-col:first-child .pg-meta, .pg-row .pg-col:first-child .pg-year { padding-left: var(--m); }
.pg-row .pg-col:first-child .pg-img { margin-left: var(--m); }

@media (max-width: 1100px) { .pg-row { min-height: 52vw; } }
@media (max-width: 760px)  { .pg-row { min-height: 80vw; } }
@media (max-width: 700px) {
  .pg-filters { gap: 12px; overflow-x: auto; scrollbar-width: none; }
  .pg-count { display: none; }
}

/* Yanzi "对齐吧": every row uses the same equal columns, so the vertical lines run straight
   through all rows; the images keep their own ratio, so the tops still step */
.pg-row { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
.pg-row > .pg-col:last-of-type { border-right: 1px solid #000; }
.pg-row > :last-child { border-right: 0; }
.pg-fill { align-self: end; }

/* ===== interaction (Yanzi: "需要一些 interactive effect") =====
   1. reveal — the image rises out of the year line (clip from the bottom), text follows; 90ms per column
   2. hover — the piece you point at stays, the others step back
   3. filter — re-rendered rows reveal again, so a filter change animates instead of jumping */
.pg-img { clip-path: inset(100% 0 0 0); transition: clip-path 1.1s cubic-bezier(.16, 1, .3, 1), opacity .35s; transition-delay: calc(var(--i, 0) * 90ms), 0s; }
.pg-name, .pg-meta { opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .8s cubic-bezier(.16, 1, .3, 1), color .3s; transition-delay: calc(var(--i, 0) * 90ms + 250ms); }
.pg-row.in .pg-img { clip-path: inset(0 0 0 0); }
.pg-row.in .pg-name, .pg-row.in .pg-meta { opacity: 1; transform: none; }
.pg-img > img, .pg-img > video { transform: scale(1.12); transition: transform 1.4s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i, 0) * 90ms); }
.pg-row.in .pg-img > * { transform: none; }

@media (hover: hover) {
  .pg-col { cursor: pointer; }
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-img { opacity: .28; transition-delay: 0s; }
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-name,
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-meta,
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-meta span { color: #c4c4c4; transition-delay: 0s; }
  .pg-row.in .pg-col:hover .pg-img > * { transform: scale(1.04); transition-delay: 0s; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-img, .pg-name, .pg-meta, .pg-img > * { clip-path: none; opacity: 1; transform: none; transition: none; }
}

/* ===== quick view (after soyeonkimwork.com/2D-3D): magnifier cursor, click to enlarge ===== */
@media (hover: hover) { .pg-col { cursor: zoom-in; } }
.pg-view {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: #fff; cursor: zoom-out;
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s;
}
.pg-view.on { opacity: 1; visibility: visible; transition: opacity .35s; }
.pg-view-fig {
  margin: 0; width: min(78vw, calc(78vh * var(--r, 1.4))); aspect-ratio: var(--r, 1.4);
  background: #eee; overflow: hidden; transform-origin: 0 0;
  transition: transform .7s cubic-bezier(.16, 1, .3, 1);
}
.pg-view-fig > img, .pg-view-fig > video { display: block; width: 100%; height: 100%; object-fit: cover; }
.pg-view-fig.swap { animation: pg-swap .45s cubic-bezier(.16, 1, .3, 1); }
@keyframes pg-swap { from { opacity: 0; transform: translateY(10px); } }
/* caption on the bottom line, same label language as the site */
.pg-view-cap {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; height: 48px; padding: 0 var(--m);
  display: flex; align-items: center; gap: 14px; border-top: 1px solid #000;
  font: 400 13px/1 var(--sans); color: #000;
}
.pg-v-n { font-weight: 500; font-variant-numeric: tabular-nums; }
.pg-v-g { color: #6b6b6b; }
.pg-v-y { margin-left: auto; font-variant-numeric: tabular-nums; }
/* × top-right, like the project panel; arrows on the sides */
.pg-view-x { position: absolute; top: 18px; right: 18px; width: 28px; height: 28px; display: grid; place-items: center; color: #000; cursor: pointer; }
.pg-view-x svg { width: 18px; height: 18px; }
.pg-view-x:hover { opacity: .5; }
.pg-view-nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 56px; height: 56px;
  font: 400 22px/1 var(--sans); color: #000; cursor: pointer; transition: opacity .2s;
}
.pg-view-nav:hover { opacity: .5; }
.pg-prev { left: 8px; } .pg-next { right: 8px; }
@media (max-width: 700px) { .pg-view-fig { width: min(92vw, calc(70vh * var(--r, 1.4))); } .pg-view-nav { display: none; } }
@media (prefers-reduced-motion: reduce) { .pg-view-fig { transition: none; } .pg-view-fig.swap { animation: none; } }

/* Yanzi: no second year — it is already next to the tool; each row just ends on one line */
.pg-row { border-bottom: 1px solid #000; }
.pg-img { margin-bottom: 12px; }
.pg-fill { display: none; }

/* Yanzi "不要加灰色的": pointing at one piece no longer fades the others to grey —
   every image keeps its own colour; the piece under the mouse still zooms a little */
@media (hover: hover) {
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-img { opacity: 1; }
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-name { color: #000; }
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-meta span:first-child { color: #8a8a8a; }
  .pg-track:has(.pg-col:hover) .pg-col:not(:hover) .pg-meta span:last-child { color: #000; }
}

/* ===== type tester (Backsplash): poster on the left, type in the face on the right ===== */
@font-face { font-family: "Backsplash"; src: url("fonts/BacksplashBold.otf") format("opentype"); font-display: swap; }
.pg-view.has-tester { grid-template-columns: auto minmax(0, 1fr); gap: 6vw; padding: 0 7vw 48px; justify-items: start; }
.pg-tester { width: 100%; max-width: 44vw; cursor: auto; }
.pg-tester[hidden] { display: none; }
.pg-t-k { margin: 0 0 20px; padding-top: 8px; border-top: 1px solid #000; font: 400 13px/1 var(--sans); color: #8a8a8a; }
.pg-t-out {
  font: 400 clamp(36px, 5.4vw, 104px)/1.12 "Backsplash", var(--mono, monospace); color: #000;
  text-transform: uppercase; overflow-wrap: anywhere; min-height: 2.3em;
}
.pg-t-out span { display: inline-block; }
.pg-t-in {
  margin-top: 28px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid #000; border-radius: 0;
  background: transparent; font: 400 15px/1.2 var(--sans); color: #000; text-transform: uppercase; letter-spacing: .04em; outline: none;
}
.pg-t-in:focus { border-bottom-width: 2px; padding-bottom: 9px; }
@media (max-width: 700px) {
  .pg-view.has-tester { grid-template-columns: 1fr; gap: 24px; padding: 64px 16px 72px; overflow-y: auto; place-items: start center; }
  .pg-view.has-tester .pg-view-fig { width: min(60vw, calc(50vh * var(--r, 1))); }
  .pg-tester { max-width: none; }
}

/* the big letters are the field (Yanzi: "为什么不可以打" — people clicked the letters, the real field
   was a thin line under them). An invisible input covers the letters; a blinking caret follows them. */
.pg-t-box { position: relative; display: block; cursor: text; padding-bottom: 14px; border-bottom: 1px solid #000; }
.pg-t-out { display: inline; overflow-wrap: normal; word-break: keep-all; }
.pg-t-out .w { display: inline-block; white-space: nowrap; }
.pg-t-out .c { display: inline-block; }
.pg-t-caret { display: inline-block; width: 0.05em; min-width: 2px; height: 0.8em; margin-left: 0.08em; vertical-align: -0.02em; background: #000; visibility: hidden; }
.pg-t-box:focus-within .pg-t-caret { visibility: visible; animation: pg-blink 1s steps(1) infinite; }
@keyframes pg-blink { 50% { opacity: 0; } }
.pg-t-in { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: text; font-size: 16px; }
.pg-t-in:focus { border: 0; padding: 0; }
.pg-t-box:focus-within { border-bottom-width: 2px; padding-bottom: 13px; }
@media (prefers-reduced-motion: reduce) { .pg-t-box:focus-within .pg-t-caret { animation: none; } }

/* a piece with several images: stacked in the same frame, one shows at a time, soft cross-fade */
.pg-seq { position: relative; display: block; width: 100%; height: 100%; }
.pg-seq > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s ease; }
.pg-seq > img.on { opacity: 1; }
.pg-img > .pg-seq > img { transform: none; }
@media (prefers-reduced-motion: reduce) { .pg-seq > img { transition: none; } }

/* enlarged view: arrows only for a piece with several images (they step through its own images);
   on such a piece the image itself is clickable — next image */
.pg-view:not(.multi) .pg-view-nav { display: none; }
.pg-view.multi .pg-view-fig { cursor: e-resize; }
.pg-view-fig .pg-seq > img { transition: opacity .45s ease; }
