/* Playground page — builds on style.css (same tokens, ruler nav, CTA + footer).
   Layout: text filters on a hairline with a gliding marker + pause, then a 3-column masonry of pieces. */

.page-playground {
  --pg-radius: 0px;        /* site rule: square corners. Set to 28px for the rounded look of the reference */
  --pg-gap: clamp(20px, 2.8vw, 40px);   /* 40px between pieces, as on the Framer page */
}

.page-playground {
  /* a white veil keeps the paper soft so it never competes with the work */
  background-color: #f6f6f5;
  background-image: linear-gradient(rgba(255,255,255,.75), rgba(255,255,255,.75)), url("../assets/img/playground/paper.webp");
  background-image: linear-gradient(rgba(255,255,255,.75), rgba(255,255,255,.75)), image-set(url("../assets/img/playground/paper.avif") type("image/avif"), url("../assets/img/playground/paper.webp") type("image/webp"));
  background-size: cover; background-position: center top;
  background-attachment: fixed;   /* the paper stays put while the work scrolls over it */
}
@media (hover: none) { .page-playground { background-attachment: scroll; } }   /* fixed backgrounds jitter on phones */

.pg { padding-top: clamp(96px, 11vw, 180px); }   /* title sits as low as on the Framer page */
.pg.wrap { width: auto; margin-right: var(--gutter); }

/* ---------- Header: title + intro ---------- */
.pg__head {
  display: grid; grid-template-columns: 33% minmax(0, 1fr); column-gap: 0;   /* intro starts where it does on the Framer page */
  align-items: start; margin-bottom: 56px;
}
.pg__title {
  font-family: var(--serif); font-weight: 400; font-size: 3.75rem; line-height: 1.05;   /* Apple Garamond Light cut, 60px */
  letter-spacing: 0; color: #1b6a2c;   /* 6.6:1 on white */
}
.pg__title em { font-style: italic; }
.pg__intro { font-size: 1rem; line-height: 1.375; letter-spacing: -0.2px; color: #333; padding-top: 6px; }

/* ---------- Filters + pause: plain text on a hairline, like the side-nav ruler ---------- */
.pg__bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 32px; border-bottom: 1px solid #d9d9d6;
}
.pg__tabs { position: relative; display: flex; flex-wrap: wrap; column-gap: 28px; }
.pg__tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 6px;
  min-height: 40px; padding: 10px 0 12px;
  font: 400 0.9375rem/1 var(--sans); letter-spacing: -0.2px; color: #5a5a5a;
  transition: color .2s;
}
.pg__label { display: inline-block; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.pg__count { font-family: var(--serif); font-style: italic; font-size: 0.9375rem; color: #6b6b6b; }
.pg__tab:hover { color: var(--ink); }
.pg__tab:hover .pg__label { transform: translateY(-1px); }
.pg__tab[aria-pressed="true"] { color: var(--ink); font-weight: 500; }
.pg__tab[aria-pressed="true"] .pg__count { color: #1b6a2c; }

/* the marker that glides under the selected filter (sits on the hairline) */
.pg__marker {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: var(--w, 0px);
  background: var(--ink); transform: translateX(var(--x, 0px));
  transition: transform .45s cubic-bezier(.3,1.3,.4,1), width .45s cubic-bezier(.3,1.3,.4,1);
}
.no-marker .pg__tab[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--ink); }   /* before JS measures */

.pg__pause {
  appearance: none; border: 0; background: none; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 0 10px;
  font: 400 0.875rem/1 var(--sans); color: #5a5a5a; transition: color .2s;
}
.pg__pause:hover { color: var(--ink); }
.pg__ico { width: 18px; height: 18px; fill: currentColor; }
.pg__ico--play, .pg__pause[aria-pressed="true"] .pg__ico--pause { display: none; }
.pg__pause[aria-pressed="true"] .pg__ico--play { display: block; }
@media (pointer: coarse) { .pg__tab, .pg__pause { min-height: 44px; } }

.pg__tab:focus-visible, .pg__pause:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pg__marker, .pg__label { transition: none; } }

/* ---------- Masonry grid: full-bleed pieces, tight gaps, small captions ---------- */
.pg__grid {
  --cols: 3;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--pg-gap); row-gap: var(--pg-gap); align-items: start;
}
/* with JS: 1px rows, and each piece is placed into the shortest column in order */
.pg__grid.is-masonry { grid-auto-rows: 1px; row-gap: 0; }
.pg-card { min-width: 0; }
.pg-card figure { margin: 0; }
.pg-card img, .pg-card video {
  width: 100%; height: auto; border-radius: var(--pg-radius);
  background: #f1f1f1; transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.pg-card:hover img, .pg-card:hover video { transform: translateY(-3px); }
.pg-card figcaption { margin-top: 10px; font-size: 0.875rem; line-height: 1.35; letter-spacing: -0.2px; color: var(--ink); }
.pg-card figcaption span { color: var(--text-muted); }

/* filtering: hidden cards leave the flow so the columns reflow */
.pg-card[hidden] { display: none; }
.pg-card.is-entering { animation: pgIn .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pgIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.pg__empty { font-size: 1rem; color: var(--text-muted); padding: 40px 0; }

.pg.is-paused .pg-card img, .pg.is-paused .pg-card video { transition: none; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  .pg-card img, .pg-card video { transition: none; }
  .pg-card:hover img, .pg-card:hover video { transform: none; }
  .pg-card.is-entering { animation: none; }
}

/* ---------- Closing statement: polaroid left, line about me right (same columns + type as the header) ---------- */
.pg-note { margin-top: clamp(80px, 10vw, 160px); display: grid; grid-template-columns: auto minmax(0, 640px); column-gap: clamp(32px, 4vw, 64px); align-items: center; justify-content: center; }
.page-playground .pg-note.wrap { width: auto; margin-right: var(--gutter); }   /* centred within the three-column grid */
.pg-note__photo { margin: 0; width: 300px; max-width: 100%; transform: rotate(-3deg); transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.pg-note__photo:hover { transform: rotate(-1deg) translateY(-4px); }
.pg-note__photo img { width: 100%; height: auto; }
.pg-note__text strong { font-weight: 700; color: var(--ink); }
.pg-note__text { font-size: 1rem; line-height: 1.375; letter-spacing: -0.2px; color: #333; }
@media (max-width: 760px) {
  .pg-note { grid-template-columns: 1fr; row-gap: 28px; justify-items: center; }
  .pg-note__photo { width: min(70%, 260px); }
}
@media (prefers-reduced-motion: reduce) { .pg-note__photo { transition: none; } }

/* ---------- Click to view a piece full size ---------- */
.pg-card__open {
  appearance: none; border: 0; padding: 0; margin: 0; background: none; display: block; width: 100%;
  cursor: zoom-in; color: inherit; font: inherit; text-align: left;
}
.pg-card__open:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.pg-view {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none; width: 100vw; height: 100dvh;
  background: rgba(246,246,245,.97); color: var(--ink);
}
.pg-view::backdrop { background: rgba(246,246,245,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pg-view[open] { animation: pgViewIn .3s ease-out both; }
.pg-view[open] .pg-view__media > * { animation: pgViewZoom .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pgViewIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pgViewZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.pg-view__inner {
  position: relative; height: 100%;
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 16px;
  padding: 64px clamp(16px, 3vw, 48px) 40px;
}
.pg-view__fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 0; height: 100%; justify-content: center; }
.pg-view__media { display: flex; justify-content: center; align-items: center; min-height: 0; width: 100%; flex: 1 1 auto; }
.pg-view__media img, .pg-view__media video {
  display: block; max-width: 100%; max-height: calc(100dvh - 170px); width: auto; height: auto; object-fit: contain;
}
.pg-view__cap { font-size: 0.9375rem; line-height: 1.4; letter-spacing: -0.2px; text-align: center; }
.pg-view__cap span { color: var(--text-muted); }

.pg-view__close, .pg-view__nav {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--ink);
  width: 48px; height: 48px; display: grid; place-items: center; transition: transform .2s, background .2s;
}
.pg-view__close { position: absolute; top: 12px; right: clamp(12px, 2vw, 32px); }
.pg-view__close:hover { transform: rotate(90deg); }
.pg-view__nav:hover { background: rgba(0,0,0,.05); }
.pg-view__nav--prev:hover svg { transform: translateX(-2px); }
.pg-view__nav--next:hover svg { transform: translateX(2px); }
.pg-view__close svg, .pg-view__nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .2s; }
.pg-view__close:focus-visible, .pg-view__nav:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pg-view__nav[hidden] { visibility: hidden; display: grid; }
html.pg-view-open { overflow: hidden; }

@media (max-width: 760px) {
  .pg-view__inner { grid-template-columns: 1fr; padding: 64px 16px 88px; }
  .pg-view__nav { position: absolute; bottom: 20px; }
  .pg-view__nav--prev { left: 16px; } .pg-view__nav--next { right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-view[open], .pg-view[open] .pg-view__media > * { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .pg { padding-top: 36px; }
  .pg.wrap { margin-right: var(--gutter); }
}
@media (max-width: 760px) { .pg__head { grid-template-columns: 1fr; row-gap: 14px; margin-bottom: 32px; } .pg__title { font-size: 2.75rem; } }
@media (max-width: 860px) { .pg__grid { --cols: 2; } }
@media (max-width: 560px) {
  .pg__grid { --cols: 1; }
  .pg__bar { align-items: flex-start; }
  .pg__intro { font-size: 1rem; }
}
