/* Peabyte Games: a shelf of games on a pegboard wall, under a pod of today's dailies.
   The one idea: pea + byte. A pea you've opened today has a pixel bite out of it. */
@font-face { font-family: "Bagel Fat One"; src: url(fonts/bagel-fat-one-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url(fonts/atkinson-hyperlegible-next-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --pea: #8cc63f;
  --pea-light: #b9e36a;
  --pod: #5c9e24;
  --pod-deep: #32650f;
  --ink: #0f2e1a;
  --wall: #17452b;
  --wall-dot: #1f5636;
  --plank: #f7c948;
  --plank-edge: #b9820f;
  --milk: #f4f9e1;
  --soft: #cfe3b4;
  --focus: #ffffff;
  --display: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: "Atkinson Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body { margin: 0; background: var(--wall); color: var(--milk); font: 400 1rem/1.4 var(--body); overflow-x: hidden; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
img { display: block; }
button, select { font: inherit; color: inherit; }
.defs { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 5; background: var(--ink); color: var(--milk); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.wall :focus-visible, .foot :focus-visible { outline-color: var(--focus); }

/* ---------- the pea-green top: name, language, today's pod ---------- */
.top { background: var(--pea); color: var(--ink); padding-bottom: 8px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gutter) 6px; }
.brand { display: flex; align-items: center; gap: 8px; font: 400 2rem/1 var(--display); letter-spacing: .005em; }
.brand-pea { width: 32px; height: 32px; flex: none; }
/* "Games" rides along as a smaller word. Where the row is too narrow (phones under ~380px) it tucks under
   "Peabyte" as a tight two-line lockup instead of pushing the language switch off the row. */
.brand-word { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .22em; line-height: .92; }
.brand-sub { font-size: .62em; letter-spacing: .01em; }
.langs { display: flex; flex: none; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.lang { background: none; border: 0; padding: 0 12px; min-height: 40px; font-size: .9375rem; cursor: pointer; }
.lang[aria-pressed="true"] { background: var(--ink); color: var(--pea-light); font-weight: 700; }
.lang-short { display: none; }
@media (max-width: 379px) { .lang-full { display: none; } .lang-short { display: inline; } .brand { font-size: 1.75rem; } }
.lang:focus-visible { outline-offset: -5px; outline-color: currentColor; }

.pod-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; padding: 4px var(--gutter) 8px; }
.pod-head h2 { font: 400 1.25rem/1.2 var(--display); }
.pod-head p { font-size: .9375rem; }
@media (max-width: 619px) and (max-height: 620px) { .pod-head p { display: none; } }

/* The pod runs off the screen on both sides, split open, peas inside. */
.pod { background: var(--pod-deep); border-block: 5px solid var(--pod); box-shadow: inset 0 7px 0 #27520a; overflow: hidden; }
.pod-list { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--pea-light) transparent; padding: 12px 6px 8px; -webkit-overflow-scrolling: touch; }
.pod-item { position: relative; flex: none; width: 108px; }
.pea { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: var(--milk); padding: 0 3px; border-radius: 10px; height: 100%; }
.pea:focus-visible { outline-color: var(--focus); outline-offset: -1px; }
.seed {
  display: block; flex: none; width: 76px; height: 76px; border-radius: 50%; background: var(--c, var(--pea)); overflow: hidden;
  border: 3px solid var(--pea-light); box-shadow: inset 0 0 0 1px var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path .28s steps(3), transform .15s;
}
.seed img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
/* An 8 by 8 grid of "pixels": the bite has square edges on purpose. */
.pea.bitten .seed { clip-path: polygon(0 0, 62.5% 0, 62.5% 12.5%, 50% 12.5%, 50% 37.5%, 62.5% 37.5%, 62.5% 50%, 87.5% 50%, 87.5% 62.5%, 100% 62.5%, 100% 100%, 100% 100%, 0 100%); }
.pea-name { font: 700 .875rem/1.15 var(--body); margin-top: 7px; }
.pea-daily { font-size: .8125rem; line-height: 1.15; color: var(--pea-light); margin-top: 2px; }
@media (hover: hover) { .pea:hover .seed { transform: translateY(-3px); } }
.ready .pod-item { animation: pop .34s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.ready .pod-item:nth-child(2) { animation-delay: 40ms; } .ready .pod-item:nth-child(3) { animation-delay: 80ms; }
.ready .pod-item:nth-child(4) { animation-delay: 120ms; } .ready .pod-item:nth-child(5) { animation-delay: 160ms; }
.ready .pod-item:nth-child(6) { animation-delay: 200ms; } .ready .pod-item:nth-child(7) { animation-delay: 240ms; }
.ready .pod-item:nth-child(n+8) { animation-delay: 280ms; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- the wall ---------- */
.wall { background-color: var(--wall); background-image: radial-gradient(var(--wall-dot) 2.5px, transparent 3px); background-size: 26px 26px; outline: none; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px var(--gutter) 4px; }
.chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 13px 4px 9px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 2px solid var(--soft); color: var(--milk); font-size: .9375rem; line-height: 1.1; text-align: left;
}
@media (hover: hover) { .chip:hover { border-color: var(--plank); } }
.chip[aria-pressed="true"] { background: var(--plank); border-color: var(--plank); color: var(--ink); font-weight: 700; }
.ico { width: 18px; height: 18px; flex: none; }
.sorter { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: .9375rem; color: var(--soft); }
/* On a phone the select says what it does, and the count stays for screen readers only. */
.count, #sort-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sort-box { display: flex; align-items: center; gap: 6px; }
.sort-box select { background: var(--wall); color: var(--milk); border: 2px solid var(--soft); border-radius: 8px; min-height: 40px; padding: 0 6px; max-width: 12em; cursor: pointer; }

/* Boxes stand on a plank, the name hangs under it. Each slot's plank reaches past the screen edges,
   so a row reads as one long board however many games are on it. */
.shelf {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto;
  padding: 14px 10px 0; overflow-x: clip;
}
.slot { grid-row: span 2; display: grid; grid-template-rows: subgrid; min-width: 0; padding: 0 6px; }
.slot:nth-child(3n+1) { grid-column: span 2; }
.game { grid-row: span 2; display: grid; grid-template-rows: subgrid; text-decoration: none; color: inherit; min-width: 0; outline: none; }
.frame {
  position: relative; display: block; align-self: end; z-index: 1; margin-right: 7px;
  aspect-ratio: 4 / 3; background: var(--c); border: 4px solid var(--c); border-radius: 6px;
  box-shadow: 7px 0 0 -2px color-mix(in srgb, var(--c) 62%, #000), 7px -2px 0 -2px color-mix(in srgb, var(--c) 62%, #000);
  transform-origin: 50% 100%; transition: transform .16s cubic-bezier(.3, 1.6, .5, 1);
}
.frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.fallback { display: none; }
.no-pic .fallback { display: flex; align-items: center; justify-content: center; height: 100%; padding: 12px; text-align: center; font: 400 1.5rem/1.1 var(--display); color: #fff; }
.slot:nth-child(4n+1) .frame { transform: rotate(-.8deg); }
.slot:nth-child(4n+3) .frame { transform: rotate(.7deg); }
.game:focus-visible .frame { transform: translateY(-7px) rotate(0); }
@media (hover: hover) { .game:hover .frame { transform: translateY(-7px) rotate(0); } }
.game:active .frame { transform: translateY(-2px) rotate(0); }
.game:focus-visible .frame { outline: 4px solid var(--focus); outline-offset: 2px; }
.game:focus-visible .name { text-decoration: underline; }

.tag { position: relative; display: block; padding: 25px 2px 24px; }
.tag::before {
  content: ""; position: absolute; top: 0; left: -100vw; right: -100vw; height: 14px;
  background: var(--plank); box-shadow: inset 0 -4px 0 var(--plank-edge), 0 6px 0 rgba(8, 30, 16, .45);
}
.tag-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.name { font: 400 1.375rem/1.1 var(--display); color: var(--milk); min-width: 0; overflow-wrap: anywhere; }
.marks { display: flex; gap: 4px; flex: none; color: var(--plank); padding-top: 3px; }
.mark { position: relative; display: flex; }
.line { display: block; margin-top: 4px; font-size: .9375rem; line-height: 1.3; color: var(--soft); }
.slot:not(:nth-child(3n+1)) .name { font-size: 1.125rem; }

.hop { animation: hop .3s cubic-bezier(.3, 1.5, .5, 1) var(--d, 0ms) backwards; }
@keyframes hop { from { transform: translateY(12px); opacity: 0; } }

.empty { padding: 44px var(--gutter) 60px; text-align: center; font-size: 1.125rem; }
.empty .chip { margin-top: 12px; padding-left: 13px; }
.offline { position: sticky; bottom: 0; z-index: 3; background: var(--ink); color: var(--pea-light); padding: 10px var(--gutter); font-size: .9375rem; text-align: center; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 18px var(--gutter) calc(22px + env(safe-area-inset-bottom)); background: var(--ink); font-size: .9375rem; color: var(--soft); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot a { color: var(--milk); padding: 6px 0; display: inline-block; }
.noscript { padding: 16px; background: var(--plank); color: var(--ink); }

/* ---------- larger screens ---------- */
@media (min-width: 620px) {
  :root { --gutter: 24px; }
  .shelf { grid-template-columns: repeat(12, minmax(0, 1fr)); padding-inline: 16px; }
  .slot, .slot:nth-child(3n+1) { grid-column: span 6; }
  .slot:nth-child(4n+1), .slot:nth-child(4n+4) { grid-column: span 7; }
  .slot:nth-child(4n+2), .slot:nth-child(4n+3) { grid-column: span 5; }
  .slot:not(:nth-child(3n+1)) .name, .name { font-size: 1.375rem; }
  .count, #sort-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .pod-item { width: 112px; }
  .seed { width: 88px; height: 88px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; }
  .brand { font-size: 2.5rem; }
  .brand-pea { width: 40px; height: 40px; }
  .bar { padding-top: 12px; }
  .top { padding-bottom: 18px; }
  .pod-wrap { display: flex; align-items: stretch; }
  .pod-head { flex: none; width: 222px; flex-direction: column; justify-content: center; padding: 0 16px 0 var(--gutter); }
  .pod-head h2 { font-size: 1.5rem; }
  .pod { flex: 1; min-width: 0; border-radius: 80px 0 0 80px; border-right: 0; border-left: 5px solid var(--pod); }
  .pod-list { padding-left: 28px; }
  .shelf { padding-inline: max(28px, calc((100% - 1440px) / 2)); }
  /* Three boxes to a plank, in three different sizes, and the big one moves along each row. */
  .slot:nth-child(n) { grid-column: span 4; }
  .slot:nth-child(9n+1), .slot:nth-child(9n+5), .slot:nth-child(9n+9) { grid-column: span 5; }
  .slot:nth-child(9n+3), .slot:nth-child(9n+4), .slot:nth-child(9n+8) { grid-column: span 3; }
  .tag { padding-bottom: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- privacy page ---------- */
.doc { background: var(--milk); color: var(--ink); }
.doc .top { padding-bottom: 6px; }
.doc .brand { text-decoration: none; }
.page { max-width: 42rem; padding: 24px var(--gutter) 56px; margin: 0 auto; line-height: 1.5; }
.page h1 { font: 400 2.25rem/1.1 var(--display); }
.page h2 { font: 400 1.375rem/1.2 var(--display); margin-top: 28px; }
.page p { margin-top: 8px; }
.page ul { margin-top: 8px; list-style: disc; padding-left: 20px; }
.page li { margin-top: 10px; }
.page .lead { font-size: 1.1875rem; font-weight: 700; line-height: 1.35; margin-top: 16px; }
.dated { color: #40584a; font-size: .9375rem; }
