/* ==========================================================================
   layout.css — Playroom page shell
   --------------------------------------------------------------------------
   Shell parts:
     .pop-topbar      floating rounded pill nav (brand + links + search)
     .pop-dock        bottom tab bar, mobile only
     .pop-band        full-width rounded colour band
     .pop-footer      ink footer with a large wordmark and link columns
     .pop-page        flex column so the footer always sits at the bottom
   ========================================================================== */

.pop-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.pop-main {
  flex: 1 0 auto;
  padding-top: 1.1rem;
  /* Guarantees the main column is at least a viewport tall, so a short page
     does not let the footer jump up and then settle once JS fills content in. */
  min-height: calc(100vh - 12rem);
}

/* --------------------------------------------------------------------------
   Top bar — floating pill
   -------------------------------------------------------------------------- */
.pop-topbar {
  /* Intentionally in normal flow: the bar scrolls away with the page. */
  position: relative;
  z-index: 80;
  padding: 0.85rem 0 0.5rem;
  background: linear-gradient(180deg, var(--pop-cream) 62%, rgba(255, 247, 240, 0));
}

.pop-topbar__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem 0.55rem 0.9rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-white);
  box-shadow: var(--pop-shadow-md);
}

/* Brand ------------------------------------------------------------------- */
.pop-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 0 0 auto;
}

.pop-brand__mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--pop-r-sm);
  background-color: var(--pop-orange);
  background-image: linear-gradient(145deg, var(--pop-orange), var(--pop-sun));
  /* Ink keeps the monogram legible at 5.19:1 against the orange stop. */
  color: var(--pop-ink);
  font-family: var(--pop-display);
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: inset 0 -3px 0 rgba(32, 41, 52, 0.16);
  transition: transform var(--pop-fast) var(--pop-spring);
}

.pop-brand:hover .pop-brand__mark {
  transform: rotate(-8deg) scale(1.06);
}

.pop-brand__name {
  font-family: var(--pop-display);
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.42rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav links --------------------------------------------------------------- */
.pop-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-inline: auto;
  /* Never shrink below the label widths: the page title changes per entry, and
     a nav that reflows when the title grows causes a visible layout shift. */
  flex: 0 0 auto;
}

.pop-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--pop-r-pill);
  font-family: var(--pop-display);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--pop-ink-2);
  white-space: nowrap;
  transition: background var(--pop-fast) var(--pop-ease), color var(--pop-fast) var(--pop-ease);
}

.pop-nav__link:hover {
  background: var(--pop-cream);
  color: var(--pop-ink);
}

.pop-nav__link[aria-current="page"] {
  background: var(--pop-ink);
  color: var(--pop-white);
}

/* Right side actions ------------------------------------------------------ */
.pop-topbar__end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.pop-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-cream);
  transition: background var(--pop-fast) var(--pop-ease), box-shadow var(--pop-fast) var(--pop-ease);
}

.pop-search:focus-within {
  background: var(--pop-white);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.28);
}

.pop-search svg {
  flex: 0 0 auto;
  color: var(--pop-ink-2);
}

.pop-search input {
  width: 9rem;
  border: 0;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
}

.pop-search input::placeholder {
  color: var(--pop-ink-2);
  font-weight: 500;
}

/* Hamburger / drawer trigger ---------------------------------------------- */
.pop-burger {
  display: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--pop-r-sm);
  background: var(--pop-cream);
  transition: background var(--pop-fast) var(--pop-ease);
}

.pop-burger:hover {
  background: var(--pop-cream-deep);
}

.pop-burger span {
  display: block;
  width: 1.15rem;
  height: 2.5px;
  border-radius: 2px;
  background: var(--pop-ink);
  box-shadow: 0 -6px 0 var(--pop-ink), 0 6px 0 var(--pop-ink);
}

/* Drawer ------------------------------------------------------------------ */
.pop-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

.pop-drawer.is-open {
  display: block;
}

.pop-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(32, 41, 52, 0.44);
  animation: pop-fade var(--pop-fast) var(--pop-ease);
}

.pop-drawer__panel {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1rem calc(1.4rem + env(safe-area-inset-bottom));
  border-radius: var(--pop-r-xl) var(--pop-r-xl) 0 0;
  background: var(--pop-cream);
  box-shadow: var(--pop-shadow-lg);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: pop-rise var(--pop-mid) var(--pop-spring);
}

.pop-drawer__grab {
  width: 3rem;
  height: 0.3rem;
  margin: 0 auto 0.6rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-line-strong);
}

.pop-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.6rem;
}

.pop-drawer__title {
  font-family: var(--pop-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.pop-drawer__close {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--pop-white);
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: var(--pop-shadow-sm);
}

.pop-drawer__label {
  display: block;
  margin: 0.55rem 0 0.4rem;
  font-family: var(--pop-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pop-ink-2);
}

.pop-drawer__list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pop-drawer__list a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--pop-r-md);
  background: var(--pop-white);
  font-family: var(--pop-display);
  font-size: 1rem;
  font-weight: 500;
  box-shadow: var(--pop-shadow-sm);
}

.pop-drawer__list a[aria-current="page"] {
  background: var(--pop-ink);
  color: var(--pop-white);
}

.pop-drawer__list a b {
  margin-left: auto;
  font-family: var(--pop-body);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--pop-ink-2);
}

.pop-drawer__list a[aria-current="page"] b {
  color: var(--pop-sun);
}

@keyframes pop-fade {
  from {
    opacity: 0;
  }
}

@keyframes pop-rise {
  from {
    transform: translateY(24px);
  }
}

/* --------------------------------------------------------------------------
   Bottom dock — mobile only
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Floating menu button (bottom right)
   --------------------------------------------------------------------------
   Replaces the full-width bottom tab bar. A single round button sits near the
   bottom-right corner; tapping it fans the navigation links upward. Closed by
   default so it never competes with the page content, and it clears the
   back-to-top button which shares the same corner.
   -------------------------------------------------------------------------- */
.pop-dock {
  position: fixed;
  right: clamp(0.85rem, 3vw, 1.6rem);
  bottom: calc(0.95rem + env(safe-area-inset-bottom));
  z-index: 96;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

/* The toggle: a chip showing the current section, so the button has a label
   rather than being an unlabelled icon. */
.pop-dock__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-ink);
  color: var(--pop-white);
  box-shadow: var(--pop-shadow-lg);
  font-family: var(--pop-display);
  font-size: 0.86rem;
  font-weight: 600;
  transition:
    background var(--pop-fast) var(--pop-ease),
    transform var(--pop-fast) var(--pop-spring);
}

.pop-dock__toggle:hover {
  background: var(--pop-orange);
  color: var(--pop-ink);
}

.pop-dock__toggle:active {
  transform: scale(0.95);
}

.pop-dock__toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--pop-mid) var(--pop-spring);
}

.pop-dock.is-open .pop-dock__toggle svg {
  transform: rotate(45deg);
}

/* The link list, hidden until the toggle is pressed. `display: none` while
   closed keeps the collapsed dock exactly one button tall, so it can never
   reserve empty space in the corner. */
.pop-dock__list {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0;
  list-style: none;
}

.pop-dock.is-open .pop-dock__list {
  display: flex;
}

.pop-dock__list a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-white);
  color: var(--pop-ink);
  box-shadow: var(--pop-shadow-md);
  font-family: var(--pop-display);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  /* Collapsed state: no layout participation, so nothing shifts. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.94);
  transform-origin: bottom right;
  transition:
    opacity var(--pop-fast) var(--pop-ease),
    transform var(--pop-mid) var(--pop-spring),
    visibility var(--pop-fast),
    background var(--pop-fast) var(--pop-ease);
}

.pop-dock.is-open .pop-dock__list a {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* Stagger the items so they fan out rather than appearing all at once. */
.pop-dock.is-open .pop-dock__list li:nth-child(1) a { transition-delay: 0ms; }
.pop-dock.is-open .pop-dock__list li:nth-child(2) a { transition-delay: 45ms; }
.pop-dock.is-open .pop-dock__list li:nth-child(3) a { transition-delay: 90ms; }
.pop-dock.is-open .pop-dock__list li:nth-child(4) a { transition-delay: 135ms; }

.pop-dock__list a[aria-current="page"] {
  background: var(--pop-ink);
  color: var(--pop-white);
}

.pop-dock__list a svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Back-to-top button — bottom right, appears after the first screen
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Bands & sections
   -------------------------------------------------------------------------- */
.pop-band {
  margin-block: var(--pop-band);
}

.pop-band--tint,
.pop-band--sun,
.pop-band--mint {
  margin-inline: clamp(0.5rem, 2vw, 1.5rem);
  padding-block: clamp(2rem, 4.5vw, 3.6rem);
  border-radius: var(--pop-r-xl);
}

.pop-band--tint {
  background: var(--pop-white);
}

.pop-band--sun {
  background: linear-gradient(135deg, #fff3d1, #ffe7c2);
}

.pop-band--mint {
  background: linear-gradient(135deg, #e4fbf3, #d3f4ea);
}

.pop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
  margin-bottom: clamp(1.25rem, 2.6vw, 2rem);
}

.pop-head h2 {
  margin-top: 0.6rem;
  max-width: 22ch;
}

.pop-head p.pop-note {
  max-width: 32ch;
  font-size: 0.94rem;
  color: var(--pop-ink-2);
}

/* Prose (legal / about / article) ----------------------------------------- */
.pop-prose {
  max-width: 72ch;
  font-size: 1.02rem;
  line-height: 1.75;
}

.pop-prose > * + * {
  margin-top: 1rem;
}

.pop-prose h2 {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 2px dashed var(--pop-line-strong);
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.8rem);
}

.pop-prose h3 {
  margin-top: 1.6rem;
}

.pop-prose ul,
.pop-prose ol {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-left: 1.2rem;
  list-style: disc;
}

.pop-prose ol {
  list-style: decimal;
}

.pop-prose li::marker {
  color: var(--pop-orange-text);
  font-weight: 800;
}

.pop-prose a {
  color: var(--pop-orange-text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.pop-prose a:hover {
  color: var(--pop-pink-text);
}

.pop-prose blockquote {
  padding: 1rem 1.15rem;
  border-radius: var(--pop-r-md);
  background: #fff3d1;
  font-family: var(--pop-display);
  font-size: 1.06rem;
  font-weight: 500;
  line-height: 1.5;
}

.pop-prose code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--pop-cream-deep);
  font-size: 0.88em;
}

.pop-prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--pop-r-md);
  background: var(--pop-white);
  box-shadow: var(--pop-shadow-sm);
  font-size: 0.92rem;
  table-layout: fixed;
}

.pop-prose th,
.pop-prose td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--pop-line);
}

.pop-prose tr:last-child td {
  border-bottom: 0;
}

.pop-prose th {
  background: var(--pop-cream-deep);
  font-family: var(--pop-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pop-ink);
}

.pop-prose td code {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .pop-prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    table-layout: auto;
  }

  .pop-prose thead,
  .pop-prose tbody {
    display: table;
    width: 100%;
    min-width: 24rem;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.pop-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: clamp(2.2rem, 4vw, 3rem);
  border-radius: var(--pop-r-xl) var(--pop-r-xl) 0 0;
  background: var(--pop-ink);
  color: var(--pop-white);
}

.pop-footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: clamp(1.4rem, 3vw, 2.5rem);
  padding-bottom: clamp(1.8rem, 3vw, 2.5rem);
}

.pop-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-width: 32ch;
}

.pop-footer__brandname {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--pop-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.pop-footer__brand .pop-brand__mark {
  background: linear-gradient(145deg, var(--pop-orange), var(--pop-sun));
  color: var(--pop-ink);
}

.pop-footer__blurb {
  font-size: 0.94rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
}

.pop-footer__col h2 {
  margin-bottom: 0.75rem;
  font-family: var(--pop-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pop-sun);
}

.pop-footer__col ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pop-footer__col a {
  font-size: 0.94rem;
  color: rgba(255, 255, 255, 0.78);
  transition: color var(--pop-fast) var(--pop-ease), padding-left var(--pop-fast) var(--pop-ease);
}

.pop-footer__col a:hover {
  color: var(--pop-white);
  padding-left: 0.2rem;
}

.pop-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  padding-block: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
}

.pop-footer__dots {
  display: flex;
  gap: 0.3rem;
}

.pop-footer__dots i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.pop-footer__dots i:nth-child(1) {
  background: var(--pop-orange);
}

.pop-footer__dots i:nth-child(2) {
  background: var(--pop-sun);
}

.pop-footer__dots i:nth-child(3) {
  background: var(--pop-mint);
}

.pop-footer__dots i:nth-child(4) {
  background: var(--pop-pink-text);
}

/* --------------------------------------------------------------------------
   Responsive shell
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .pop-nav__link {
    padding: 0.5rem 0.65rem;
    font-size: 0.86rem;
  }

  .pop-search input {
    width: 7rem;
  }
}

@media (max-width: 860px) {
  .pop-nav {
    display: none;
  }

  /* The summary pages add an "All games" pill beside the menu button. On
     phones there is not room for both, so the pill folds away. */
  .pop-topbar__end .pop-btn--sm {
    display: none;
  }

  .pop-topbar__inner {
    justify-content: space-between;
  }

  .pop-search {
    display: none;
  }

  .pop-burger {
    display: grid;
  }

  .pop-footer__top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pop-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .pop-topbar {
    padding-top: 0.6rem;
  }

  .pop-main {
    padding-top: 0.5rem;
  }

  .pop-band--tint,
  .pop-band--sun,
  .pop-band--mint {
    margin-inline: 0.55rem;
    border-radius: var(--pop-r-lg);
  }

  .pop-footer__top {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .pop-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* --------------------------------------------------------------------------
   Back-to-top button — bottom right, appears after the first screen
   -------------------------------------------------------------------------- */
.pop-totop {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 95;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--pop-ink);
  color: var(--pop-white);
  box-shadow: var(--pop-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition:
    opacity var(--pop-mid) var(--pop-ease),
    transform var(--pop-mid) var(--pop-spring),
    visibility var(--pop-mid),
    background var(--pop-fast) var(--pop-ease);
}

.pop-totop.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.pop-totop:hover {
  background: var(--pop-orange);
  color: var(--pop-ink);
}

.pop-totop:active {
  transform: scale(0.94);
}

.pop-totop svg {
  width: 18px;
  height: 18px;
}

/* Stack above the floating menu button in the same corner. */
.pop-totop {
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
  transition:
    opacity var(--pop-mid) var(--pop-ease),
    transform var(--pop-mid) var(--pop-spring),
    visibility var(--pop-mid),
    background var(--pop-fast) var(--pop-ease);
}

/* While the menu is open its links occupy this corner, so the back-to-top
   button steps out of the way instead of sitting underneath them. */
body:has(.pop-dock.is-open) .pop-totop {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
}

@media (max-width: 720px) {
  .pop-totop {
    bottom: calc(4.4rem + env(safe-area-inset-bottom));
    width: 2.75rem;
    height: 2.75rem;
  }
}
