/* ════════════════════════════════════════════
   PLAYGROUND PAGE
════════════════════════════════════════════ */

/* Warmer near-black base (atmosphere canvas draws on top) */
.pg-body {
  background: #060608;
}

/* ── Nav: white text on dark bg, dark frosted glass when scrolled ── */
.pg-body .nav {
  z-index: 100;
}
.pg-body .nav:not(.scrolled) .nav__links a {
  color: rgba(255, 255, 255, 0.75);
}
.pg-body .nav:not(.scrolled) .nav__links a:hover {
  color: var(--white);
  opacity: 1;
}
.pg-body .nav:not(.scrolled) .nav__hamburger span {
  background: var(--white);
}

/* Dark frosted glass for scrolled nav (overrides layout.css white) */
.pg-body .nav.scrolled {
  background: rgba(6, 6, 8, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.pg-body .nav.scrolled .nav__links a {
  color: rgba(255, 255, 255, 0.75);
}
.pg-body .nav.scrolled .nav__links a:hover {
  color: var(--white);
}
.pg-body .nav.scrolled .nav__hamburger span {
  background: var(--white);
}

/* Dark mobile drawer */
.pg-body .nav__mobile-menu {
  background: rgba(6, 6, 8, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.pg-body .nav__mobile-menu a {
  color: rgba(255, 255, 255, 0.75);
}
.pg-body .nav__mobile-menu a:hover {
  color: var(--white);
}

/* ════════════════════════════════════════════
   CANVAS LAYER STACK
   0 → #pg-bg       atmosphere (pointer-events: none)
   1 → .pg-dots     CSS dot grid (pointer-events: none)
   2 → .pg-page     page content (pointer-events: none — events fall through to canvas)
   3 → #pg-draw     drawing canvas (pointer-events: auto)
   4 → #pg-grain    film grain overlay (pointer-events: none)
   5 → .pg-footer   dark bg, clickable (above drawing canvas)
  10 → .pg-clear-btn, .pg-draw-hint
 100 → .nav
════════════════════════════════════════════ */

#pg-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  /* scale(1.1) pushes edges outside the viewport so the blur doesn't
     feather to transparent at the frame boundary */
  filter: blur(20px);
  transform: scale(1.12);
}

.pg-dots {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(218,213,199,0.13) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 1;
}

#pg-grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  opacity: 0.08;
  /* scaled up from half-resolution source */
  image-rendering: pixelated;
}

#pg-draw {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  cursor: none;
  /* touch-action: none — disabled alongside touch drawing (re-enable when drawing returns)
  touch-action: none; */
}

.pg-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 20;
  display: none;
  user-select: none;
  /* crayon tip sits at the very bottom-center of the image;
     shift left 50% and up 97% so the tip lands on the pointer */
  transform: translate(-50%, -97%);
}
.pg-cursor.active {
  display: block;
}
.pg-cursor img {
  width: 3.2rem;
  height: auto;
  display: block;
}

/* ── Main page wrapper ── */
.pg-page {
  position: relative;
  z-index: 2;
  pointer-events: none; /* let events pass through to #pg-draw */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(3rem, 6vw, 5rem);
  padding: 10rem var(--page-margin) 6rem;
  max-width: var(--content-max);
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── Hero text block ── */
.pg-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  max-width: 40rem;
  padding-bottom: 2rem;
}

.pg-label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.14em;
  color: var(--sand);
  opacity: 0.7;
}

.pg-headline {
  font-family: var(--font-display);
  font-size: var(--text-section);
  color: var(--white);
  font-weight: 600;
  line-height: 1.2;
}

.pg-subtext {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: rgba(218, 213, 199, 0.55);
  line-height: 1.65;
}

/* ── Card grid ── */
.pg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
  align-items: start;
}

/* Per-card rotation angles — overridden at each breakpoint */
.pg-card:nth-child(1) { --angle: -2deg; }
.pg-card:nth-child(2) { --angle:  3deg;   margin-top: 2.5rem; }
.pg-card:nth-child(3) { --angle: -1.5deg; margin-top: 1rem; }

/* ── Individual card ── */
.pg-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(218, 213, 199, 0.13);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transform: rotate(var(--angle, 0deg));
  transition: transform 0.5s var(--ease-out),
              box-shadow 0.5s var(--ease-out),
              background 0.3s ease;
}

.pg-card:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.07);
}

.pg-card__num {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.08em;
  color: rgba(218, 213, 199, 0.35);
  margin-bottom: 0.25rem;
}

.pg-card__title {
  font-family: var(--font-display);
  font-size: var(--text-card);
  color: var(--white);
  font-weight: 600;
  line-height: 1.2;
}

.pg-card__desc {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
  flex: 1;
  margin-top: 0.25rem;
}

.pg-card__pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  color: rgba(218, 213, 199, 0.55);
  background: rgba(218, 213, 199, 0.07);
  border: 1px solid rgba(218, 213, 199, 0.18);
  border-radius: var(--radius-full);
  padding: 0.35rem 1rem;
  margin-top: 0.75rem;
  width: fit-content;
}

/* ── Footer: dark atmospheric, sits above the drawing canvas ── */
.pg-footer {
  position: relative;
  z-index: 5;
  background: rgba(6, 6, 8, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(218, 213, 199, 0.1);
}
.pg-footer .footer__copyright {
  color: rgba(218, 213, 199, 0.38);
}
.pg-footer .footer__col-title {
  color: rgba(218, 213, 199, 0.35);
}
.pg-footer .footer__col a {
  color: rgba(218, 213, 199, 0.60);
}
.pg-footer .footer__col a:hover {
  color: var(--white);
  opacity: 1;
}
/* Invert the mono logo so it reads on dark */
/*.pg-footer .footer__site-logo {
  filter: invert(1) opacity(0.55);
} */

/* ── Clear canvas button ── */
.pg-clear-btn {
  position: fixed;
  bottom: 2.5rem;
  right: var(--page-margin);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  color: rgba(218, 213, 199, 0.5);
  background: rgba(6, 6, 8, 0.6);
  border: 1px solid rgba(218, 213, 199, 0.18);
  border-radius: var(--radius-full);
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.pg-clear-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(218, 213, 199, 0.4);
}
.pg-clear-btn svg {
  flex-shrink: 0;
}

/* ── Draw hint ── */
.pg-draw-hint {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  color: rgba(236, 235, 230, 0.38);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.5s ease;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .pg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pg-card:nth-child(1) { --angle: -1deg; }
  .pg-card:nth-child(2) { --angle:  1.5deg; margin-top: 0; }
  .pg-card:nth-child(3) { --angle: -0.75deg; margin-top: 0; }
}

@media (max-width: 767px) {
  .pg-grid {
    grid-template-columns: 1fr;
  }
  .pg-page {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 7rem;
  }
  .pg-hero {
    align-items: flex-start;
    text-align: left;
  }
  .pg-card:nth-child(1),
  .pg-card:nth-child(2),
  .pg-card:nth-child(3) {
    --angle: 0deg;
    margin-top: 0;
  }
  .pg-card:hover {
    transform: translateY(-4px);
  }
}

/* ── Hide draw UI on touch devices (drawing disabled on touch for now) ── */
@media (pointer: coarse) {
  .pg-clear-btn,
  .pg-draw-hint {
    display: none;
  }
}
