/* Playground-only. Type, colour, header, footer, buttons and focus
   come from ../fonts.css and ../home-e.css. The title and subtitle use
   the project-page hero in ../styles.css. */

.page--playground [hidden] { display: none !important; }

.page--playground { accent-color: var(--ink); }

/* In normal flow. A sticky bar inside the page column covered the grid in Safari. */
.pg-tools {
  background: var(--bg);
  box-shadow: 0 1px 0 var(--hair);
}
html { scroll-padding-top: calc(4.875rem + env(safe-area-inset-top, 0px)); }

@media (max-width: 768px) {
  html { scroll-padding-top: calc(3.5625rem + env(safe-area-inset-top, 0px)); }
}

/* No other page styles the current nav item. Underline it here. */
.page--playground .hdr [aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-ink);
}

/* The home hero sets a width and a left offset on .hero—title.
   Clear those so the project-page title rules are the ones that show. */
.page--playground .hero—title {
  width: auto;
}

/* styles.css pads every link and washes it on hover. Cards and the
   player controls keep the treatment they already have. */
.page--playground .pg-card,
.page--playground .pg-card:hover,
.page--playground .pg-bar a,
.page--playground .pg-bar a:hover {
  padding: 0;
  margin: 0;
  background: none;
}

.pg-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.pg-count { margin-left: auto; }
.pg-search, .pg-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Geist Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: var(--muted);
}
.pg-search input {
  font: 400 16px/20px "Geist Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 40px;
  padding: 0 16px;
  width: 200px;
  min-width: 0;
}
.pg-search input:focus-visible { border-radius: 999px; }
.pg-seg {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}
.pg-seg label { position: relative; }
.pg-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.pg-seg span {
  display: block;
  padding: 0 12px;
  line-height: 38px;
  font-family: "Geist Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.pg-seg input:checked + span { background: var(--ink); color: var(--bg); }
.pg-seg input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}
.pg-grid {
  list-style: none;
  margin: 24px 0 64px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}
.pg-grid > li { min-width: 0; }
.pg-card { color: inherit; }
.pg-card h2, .pg-meta { overflow-wrap: anywhere; }
.pg-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #0c0a09; /* site dark ground, so the whole frame stays visible */
  box-shadow: var(--shadow-md);
}
.pg-thumb img,
.pg-thumb .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pg-thumb .ph {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-family: "Geist Sans", sans-serif;
  font-size: 13px;
  line-height: 20px;
}
.pg-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--outline);
  pointer-events: none;
}
.pg-empty {
  margin: 48px 0 64px;
  color: var(--muted);
  font-family: "Geist Sans", sans-serif;
  font-size: 16px;
  line-height: 24px;
}

/* Player */
.pg-frame {
  container-type: size;
  width: 100%;
  height: clamp(240px, 56vh, 640px);
  padding: 16px;
  background: #0c0a09; /* site dark ground; the movie keeps its own background inside */
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.pg-stage {
  --w: 4;
  --h: 3;
  position: relative;
  width: min(100cqw, calc(100cqh * var(--w) / var(--h)), calc(var(--w) * 2px));
  aspect-ratio: var(--w) / var(--h);
  background: var(--stage-bg, #000);
  overflow: hidden;
}
.pg-stage ruffle-player,
.pg-stage .pg-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.pg-poster {
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: var(--stage-bg, #000) center / contain no-repeat;
  color: var(--bg);
  display: grid;
  place-items: center;
}
.pg-poster .play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: "Geist Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: background-color var(--fast) var(--ease);
}
.pg-poster .play svg { width: 16px; height: 16px; fill: currentColor; }
@media (hover: hover) {
  .pg-poster:hover .play { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
}
.pg-poster:focus-visible {
  outline: 3px solid #f5f5f4;
  outline-offset: -6px;
  box-shadow: inset 0 0 0 6px #0c0a09;
}
.pg-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px;
}
.pg-bar .btn:last-child { margin-left: auto; }
.pg-bar .btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.pg-note {
  margin: 0 0 24px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text);
}
.pg-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px 32px;
  margin: 0 0 64px;
}
.pg-facts dt {
  font-family: "Geist Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
  color: var(--faint);
}
.pg-facts dd {
  margin: 4px 0 0;
  font-family: "Geist Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .pg-grid { gap: 16px; margin-bottom: 48px; }
  .pg-thumb { box-shadow: var(--shadow-sm); }
  .pg-search { flex: 1 1 100%; }
  .pg-search input { flex: 1; width: auto; }
  .page--playground .pg-bar .btn { width: auto; }
  .pg-facts { gap: 16px 24px; }
}
@media (max-width: 480px) {
  .pg-seg span { padding: 0 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-poster .play { transition: none; }
}
