/* Loopy Bird site. Hand-written, no build step. Every colour is sampled from the game's own sprites.
   Pixel art is only ever scaled by whole numbers, with image-rendering: pixelated. */

@font-face {
  font-family: "04B_19";
  src: url("../fonts/04b_19.ttf") format("truetype");
  font-display: swap;
}

:root {
  --sky: #00add8;          /* bg_day sky */
  --sky-deep: #0090b4;
  --cloud: #e9fcd9;        /* bg_day clouds: the paper for long text */
  --grass: #34cd29;        /* land.png */
  --grass-dark: #1f9417;
  --soil: #0b4f12;         /* footer: deep ground under the grass */
  --ink: #062f39;          /* outline of the game's buttons */
  --panel: #8cc0d1;        /* in-game panels */
  --panel-hi: #a4e1f5;
  --panel-edge: #29383d;
  --gold: #ffd84a;         /* only for exclusive things */
  --gold-panel: #e3ab2d;
  --gold-edge: #5c3304;
  --purple: #7c35cf;       /* the logo */
  --px: 3px;               /* one "pixel" of UI chrome */
  --pixel: "04B_19", "Courier New", monospace;
  --body: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --notch: polygon(0 var(--px), var(--px) var(--px), var(--px) 0, calc(100% - var(--px)) 0, calc(100% - var(--px)) var(--px),
    100% var(--px), 100% calc(100% - var(--px)), calc(100% - var(--px)) calc(100% - var(--px)), calc(100% - var(--px)) 100%,
    var(--px) 100%, var(--px) calc(100% - var(--px)), 0 calc(100% - var(--px)));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--soil); }
body {
  margin: 0;
  font: 400 1.125rem/1.55 var(--body);
  color: var(--ink);
  background: var(--sky);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
.px, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: var(--px) solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 7px var(--ink); }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link {
  position: absolute; left: 8px; top: -80px; z-index: 20; padding: 10px 14px;
  background: #fff; border: var(--px) solid var(--ink); font-family: var(--pixel); text-transform: uppercase; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- type: 04B_19 for display, capitals only (its lowercase reads badly) ---------- */
h1, h2, h3, .pf {
  font-family: var(--pixel); font-weight: normal; text-transform: uppercase; letter-spacing: .03em; line-height: 1.1;
}
h2 { font-size: clamp(2rem, 5.4vw, 3.5rem); margin: 0 0 .35em; }
h3 { font-size: 1.375rem; margin: 0 0 .25em; }
.outlined {
  color: #fff;
  text-shadow: -3px 0 var(--ink), 3px 0 var(--ink), 0 -3px var(--ink), 0 3px var(--ink),
    -3px -3px var(--ink), 3px -3px var(--ink), -3px 3px var(--ink), 3px 3px var(--ink), 0 7px 0 var(--ink);
}
.outlined.gold { color: var(--gold); }
.lede { font-size: clamp(1.125rem, 2.2vw, 1.3rem); max-width: 34em; margin: 0 0 1em; }
p { max-width: 38em; }

/* ---------- sprites: 3-frame strips, whole-number scale; flap when their tile is hovered or focused ---------- */
.sprite { --s: 2; display: inline-block; width: calc(var(--w) * var(--s) * 1px); height: calc(var(--h) * var(--s) * 1px); overflow: hidden; vertical-align: middle; }
.sprite img { display: block; width: calc(var(--w) * var(--s) * 3px); max-width: none; height: calc(var(--h) * var(--s) * 1px); image-rendering: pixelated; image-rendering: crisp-edges; }
.s1 { --s: 1; } .s3 { --s: 3; } .s4 { --s: 4; }
.sp-34x24 { --w: 34; --h: 24; } .sp-15x11 { --w: 15; --h: 11; } .sp-51x36 { --w: 51; --h: 36; } .sp-42x24 { --w: 42; --h: 24; }
.sp-43x24 { --w: 43; --h: 24; } .sp-39x24 { --w: 39; --h: 24; } .sp-40x30 { --w: 40; --h: 30; } .sp-34x32 { --w: 34; --h: 32; }
.sp-34x30 { --w: 34; --h: 30; } .sp-44x24 { --w: 44; --h: 24; } .sp-34x28 { --w: 34; --h: 28; }
@keyframes flap { to { transform: translateX(-100%); } }
.tile:hover .sprite img, .tile:focus-within .sprite img, .flap img { animation: flap .36s steps(3) infinite; }
@media (prefers-reduced-motion: reduce) { .tile:hover .sprite img, .tile:focus-within .sprite img, .flap img { animation: none; } }

/* ---------- panels: the game's own panel, hard outline and pixel corners ---------- */
.panel {
  background: var(--panel); border: var(--px) solid var(--panel-edge); clip-path: var(--notch);
  box-shadow: inset 0 var(--px) 0 var(--panel-hi), inset 0 calc(var(--px) * -2) 0 rgba(41, 56, 61, .22);
}
.panel.gold { background: var(--gold-panel); border-color: var(--gold-edge); box-shadow: inset 0 var(--px) 0 #ffe08a, inset 0 calc(var(--px) * -2) 0 rgba(92, 51, 4, .25); }
.paper { background: var(--cloud); border: var(--px) solid var(--ink); clip-path: var(--notch); padding: clamp(20px, 4vw, 44px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 12px 18px 10px; font: 1.05rem/1 var(--pixel); text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink); text-decoration: none; background: #f9f9f9; border: var(--px) solid var(--ink); clip-path: var(--notch);
  box-shadow: inset 0 calc(var(--px) * -3) 0 #d6dfe2;
}
.btn:hover { background: #fff; }
.btn:active { box-shadow: inset 0 var(--px) 0 #d6dfe2; transform: translateY(2px); }
.stores { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.stores a { display: block; line-height: 0; }
.stores img { width: 180px; height: auto; }

/* ---------- header ---------- */
.site-header { position: absolute; inset: 0 0 auto; z-index: 5; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.page .site-header { position: static; background: var(--sky); border-bottom: var(--px) solid var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand .pf { font-size: 1.35rem; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.site-nav a { font: 1rem/1 var(--pixel); text-transform: uppercase; color: #fff; text-decoration: none; padding: 8px 0; display: inline-block; }
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: var(--px); text-underline-offset: 6px; }
.brand .pf, .site-nav a { text-shadow: -2px 0 var(--ink), 2px 0 var(--ink), 0 -2px var(--ink), 0 2px var(--ink), 0 4px 0 var(--ink); }

/* ---------- hero: the game itself ---------- */
.hero { position: relative; background: var(--sky); }
.stage { position: relative; height: clamp(440px, 74vh, 640px); overflow: hidden;
  background: var(--sky) url("../img/sprites/bg_day.png") repeat-x left bottom 56px / 576px 1024px; image-rendering: pixelated; }
.stage::after { content: ""; position: absolute; inset: auto 0 0; height: 56px; background: url("../img/sprites/land.png") repeat-x left top / 672px 224px; image-rendering: pixelated; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.stage-copy { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 90px 16px 90px; pointer-events: none; }
.stage-copy a { pointer-events: auto; }
.logo { margin: 0; line-height: 0; }
.logo img { width: 376px; height: auto; image-rendering: pixelated; }
.tagline { margin: 22px 0 0; font: clamp(1.3rem, 3.6vw, 2rem)/1.15 var(--pixel); text-transform: uppercase; letter-spacing: .04em; max-width: none; }

/* ---------- the 200 hook: the game-over scoreboard ---------- */
.hook { background: var(--grass); border-top: var(--px) solid var(--ink); padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 8vw, 96px);
  background-image: linear-gradient(var(--grass-dark) 0 6px, transparent 6px); }
.hook .wrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.hook h2 { margin-bottom: .3em; }
.hook .wrap.stack { display: block; }
.hook .fine { font-weight: 600; margin: 0; }
.board { padding: 22px 24px 20px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "medal score" "medal best"; gap: 4px 22px; align-items: center; animation: rise .7s cubic-bezier(.2, .9, .3, 1.2) both .3s; }
.board .medal { grid-area: medal; text-align: center; }
.board .medal img { width: 88px; height: 88px; image-rendering: pixelated; display: block; }
.board .label { font: .95rem/1 var(--pixel); text-transform: uppercase; color: #0d5f9e; letter-spacing: .06em; }
.board .score { grid-area: score; text-align: right; }
.board .best { grid-area: best; text-align: right; }
.board .num { display: block; font: clamp(3.4rem, 9vw, 5.2rem)/1 var(--pixel); color: var(--gold);
  text-shadow: -4px 0 var(--ink), 4px 0 var(--ink), 0 -4px var(--ink), 0 4px var(--ink), -4px -4px var(--ink), 4px -4px var(--ink), -4px 4px var(--ink), 4px 4px var(--ink), 0 8px 0 var(--ink); }
.board .num.small { font-size: clamp(1.8rem, 4.6vw, 2.4rem); color: #fff; text-shadow: -3px 0 var(--ink), 3px 0 var(--ink), 0 -3px var(--ink), 0 3px var(--ink), 0 5px 0 var(--ink); }
@keyframes rise { from { transform: translateY(70px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .board { animation: none; } }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-head { margin-bottom: clamp(24px, 4vw, 40px); }
.section-head p { margin: 0; font-size: 1.15rem; }
.alt { background: var(--sky-deep); }
.on-sky { color: #fff; }
.on-sky a { color: #fff; }

/* bird picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.picker.big { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.big .sprite { --s: 3; }
.big .tile { padding: 20px 22px 22px; }
.big .tile p { font-size: 1.05rem; }
.tile { padding: 16px 16px 18px; display: flex; flex-direction: column; }
.tile .art { height: 84px; display: flex; align-items: center; gap: 8px; }
.big .tile .art { height: 110px; }
.tile h3 { margin: 6px 0 4px; font-size: 1.2rem; }
.tile p { margin: 0; font-size: 1rem; line-height: 1.4; }
.tile .unlock { margin-top: auto; padding-top: 10px; font-size: .9rem; font-weight: 700; color: #0b4f7e; }
.tile.mystery .art { font: 4rem/1 var(--pixel); color: var(--gold); text-shadow: -3px 0 var(--gold-edge), 3px 0 var(--gold-edge), 0 -3px var(--gold-edge), 0 3px var(--gold-edge), 0 6px 0 var(--gold-edge); }
.tile.gold .unlock { color: var(--gold-edge); }

/* worlds: tall slices side by side, like the in-game picker */
.worlds { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.worlds li { flex: 1 1 0; min-width: 0; }
.worlds figure { margin: 0; }
.worlds .frame { position: relative; display: block; border: var(--px) solid var(--ink); clip-path: var(--notch); aspect-ratio: 288 / 384; overflow: hidden; background: var(--ink); }
.worlds img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.worlds figcaption { margin-top: 8px; }
.worlds .name { display: block; font: .95rem/1.15 var(--pixel); text-transform: uppercase; color: #fff; text-shadow: -2px 0 var(--ink), 2px 0 var(--ink), 0 -2px var(--ink), 0 2px var(--ink), 0 3px 0 var(--ink); }
.worlds .how { display: block; font-size: .9rem; color: #fff; }
.worlds.many { flex-wrap: wrap; }
.worlds.many li { flex: 0 0 calc((100% - 5 * 8px) / 6); }
.worlds .gold .frame { border-color: var(--gold-edge); outline: var(--px) solid var(--gold); outline-offset: -6px; }

/* feature trio and two-panel comparison */
.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.feature { padding: 22px; }
.feature img.icon { width: 80px; height: 80px; image-rendering: pixelated; display: block; margin-bottom: 10px; }
.feature p { margin: 0; }
.medals { display: flex; gap: 6px; margin-bottom: 10px; }
.medals img { width: 44px; height: 44px; image-rendering: pixelated; }
.duel { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.duel .panel { padding: 24px; }
.duel .who { font: 1rem/1.2 var(--pixel); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 6px; }
.duel .goal { margin: 10px 0 14px; }
.duel .goal p { margin: 0 0 6px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.duel .goal .num { font: clamp(2.6rem, 6vw, 3.6rem)/1 var(--pixel); color: #fff; text-shadow: -3px 0 var(--ink), 3px 0 var(--ink), 0 -3px var(--ink), 0 3px var(--ink), 0 6px 0 var(--ink); }
.duel .gold .goal .num { color: var(--gold); text-shadow: -3px 0 var(--gold-edge), 3px 0 var(--gold-edge), 0 -3px var(--gold-edge), 0 3px var(--gold-edge), 0 6px 0 var(--gold-edge); }
.duel .or { font: 1rem/1 var(--pixel); text-transform: uppercase; }
.duel p { margin: 0 0 .6em; }
.duel .prize { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.duel .prize img.bg { width: 72px; height: 96px; border: var(--px) solid var(--gold-edge); image-rendering: pixelated; }

.promise { text-align: center; }
.promise h2 { font-size: clamp(2rem, 6vw, 4rem); }
.promise p { margin: 0 auto; }
.promise .stores { justify-content: center; }

/* blog list */
.posts { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.post-row { display: grid; grid-template-columns: 120px 1fr; gap: 18px; padding: 14px; align-items: start; text-decoration: none; }
.post-row img { width: 120px; height: auto; border: var(--px) solid var(--panel-edge); display: block; }
.post-row h3 { font-size: 1.25rem; margin: 2px 0 6px; }
.post-row h3 a { text-decoration: none; }
.post-row h3 a:hover { text-decoration: underline; }
.post-row p { margin: 0; font-size: 1rem; }
.post-row time { font: .8rem/1 var(--pixel); text-transform: uppercase; letter-spacing: .05em; color: #0d5f9e; }
.empty { font-size: 1.1rem; }

/* ---------- inner pages ---------- */
.page main { padding: clamp(36px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: clamp(2.2rem, 7vw, 4rem); margin: 0; }
.page-head time { display: block; margin-top: 16px; font: 1.15rem/1 var(--pixel); text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.6rem; margin: 1.4em 0 .5em; }
.prose h3 { font-size: 1.25rem; margin: 1.2em 0 .4em; }
.prose h4 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose a { color: #0b5a99; }
.prose .shot { display: block; margin: 0 0 1.4em; border: var(--px) solid var(--ink); width: 100%; max-width: 540px; height: auto; image-rendering: pixelated; }
.callout { padding: 16px 20px; margin-top: 1.5em; }
.callout p { margin: 0; }
.todo { background: var(--gold); padding: 0 4px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0 0 1em; }
.facts dt { font: .95rem/1.6 var(--pixel); text-transform: uppercase; }
.facts dd { margin: 0; }
.press-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; padding: 0; list-style: none; }
.press-assets li { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.press-assets img { height: 110px; width: 100%; object-fit: contain; image-rendering: pixelated; }
.share { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 1.6em 0 0; padding: 0; list-style: none; }
.share .label { font: .9rem/1 var(--pixel); text-transform: uppercase; }
.share a { font-size: .95rem; padding: 9px 12px 7px; }
.back { margin-top: 2em; }
.gameover { text-align: center; }
.gameover h1 { font-size: clamp(2.6rem, 10vw, 5rem); }
.gameover p { margin-inline: auto; }

/* ---------- footer ---------- */
.site-footer { background: var(--soil); color: #e9fcd9; }
.site-footer .ground { height: 56px; background: url("../img/sprites/land.png") repeat-x left top / 672px 224px; image-rendering: pixelated; border-top: var(--px) solid var(--ink); }
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; gap: 18px 40px; padding: 28px 0 36px; align-items: start; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: #fff; }
.site-footer .socials { margin-top: 10px; }
.site-footer p { margin: 0; }
.site-footer .made { font-size: 1rem; }

/* ---------- small screens ---------- */
@media (min-width: 900px) { .logo img { width: 564px; } }
@media (max-width: 900px) { .picker.big { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .hook .wrap { grid-template-columns: 1fr; }
  .board { max-width: 440px; }
}
@media (max-width: 760px) {
  .worlds { flex-wrap: wrap; }
  .worlds li { flex: 0 0 calc((100% - 2 * 8px) / 3); }
  .worlds.many li { flex: 0 0 calc((100% - 2 * 8px) / 3); }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 0; }
  .site-nav ul { gap: 2px 14px; }
  .site-nav a { font-size: .9rem; }
  .logo img { width: 282px; }
  .stage-copy { padding-top: 110px; }
  .picker { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .picker.big { grid-template-columns: 1fr; gap: 10px; }
  .big .tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; column-gap: 14px; align-items: start; padding: 14px; }
  .big .tile .art { grid-row: 1 / 4; height: auto; min-height: 64px; align-self: center; }
  .big .sprite { --s: 2; }
  .big .tile h3 { margin-top: 0; }
  .tile { padding: 12px 12px 14px; }
  .tile .art { height: 68px; }
  .tile h3 { font-size: 1rem; }
  .tile p { font-size: .95rem; }
  .board { padding: 18px; gap: 4px 16px; }
  .board .medal img { width: 66px; height: 66px; }
  .post-row { grid-template-columns: 72px 1fr; gap: 12px; }
  .post-row img { width: 72px; }
  .worlds li, .worlds.many li { flex: 0 0 calc((100% - 8px) / 2); }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .stores img { width: 160px; }
}

/* ---------- blog (stage 3) ---------- */
.posts { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 14px; }
.post-row span:empty { display: block; width: 120px; height: 72px; background: var(--panel-hi); border: var(--px) solid var(--panel-edge); }
.pager { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 20px; }
.tag-list a, .post-tags a { font-weight: 700; }
.post-tags { margin-top: 2em; font-size: .95rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.back { margin-top: 1.5em; }
@media (max-width: 640px) { .post-row span:empty { width: 72px; height: 48px; } .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 8px; } }

/* The page is a column: the content fills the screen, so the footer's ground sits at the bottom of short pages */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
.empty-state { text-align: center; }
/* Once the animation is drawing, its own ground replaces the static one */
.stage:has(canvas:not([hidden]))::after { display: none; }

/* Inner pages use the full page width, like the home page's sections; running text keeps a readable line
   length inside (grids such as the press artwork and post lists use the whole width) */
.page main .prose { max-width: none; }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote, .prose > h2, .prose > h3, .prose > aside, .prose > .facts { max-width: 75ch; }
.prose > ul.press-assets, .prose > .stores { max-width: none; }
.press-assets { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
