/* ==========================================================================
   Penguin Inc.
   Dark space, one lit horizon, and the penguins the game already has.
   ========================================================================== */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('/assets/fonts/PixelifySans-Regular.ttf') format('truetype');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Pixelify Sans';
  src: url('/assets/fonts/PixelifySans-Bold.ttf') format('truetype');
  font-weight: 700; font-display: swap;
}

:root {
  --bg:      #0B0C11;
  --ink:     #E8EBF2;
  --ink-dim: #99A0AE;
  --line:    #262B36;
  --orange:  #FF7A1A;

  --display: 'Pixelify Sans', ui-monospace, monospace;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --px: 3;                 /* pixel-sprite scale — whole numbers only */
  --px-far: 2;             /* … and for the ones meant to read as distant */
  --r: 108vw;              /* radius of the world in the hero */
  --rise: max(9.375rem, 11vw); /* how far its horizon sits above the fold */
}

/* ------------------------------------------------------------------- scale
   One knob for the whole page. Every length below is in rem, so the root
   font size is what makes the site fill a big display instead of sitting
   small in the middle of it: 16px on a 1280px-wide viewport, ~19.5px at
   1080p, 23px at 1440p, 30px at 4K. Written in rem rather than px so a
   reader who runs a larger default font keeps it, scaled from there.

   Change this one line to make everything bigger or smaller at once. The
   pixel sprites step separately in --px at the bottom of the file, because
   pixel art can only be scaled by whole numbers without going mushy. */
html { font-size: clamp(1rem, 0.546875vw + 0.5625rem, 1.875rem); }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.75rem, 4.6vw, 3rem); text-wrap: balance; }
p { margin: 0 0 1.1em; }
::selection { background: var(--orange); color: #14151B; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; }

.wrap { width: min(100% - 3rem, 45rem); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--orange); color: #14151B; padding: .6rem 1rem; font-family: var(--display);
}
.skip:focus { left: 1rem; top: 1rem; }

/* ------------------------------------------------------------------ button */
.btn {
  display: inline-block;
  padding: .8rem 1.6rem;
  font-family: var(--display); font-size: 1rem; font-weight: 700; letter-spacing: .03em;
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  transition: border-color .18s, background-color .18s, color .18s;
}
.btn:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.07); }
.btn--primary { background: var(--orange); border-color: var(--orange); color: #14151B; }
.btn--primary:hover { background: #FF9440; border-color: #FF9440; color: #14151B; }
.btn--sm { padding: .45rem 1rem; font-size: .9rem; }
.btn--lg { padding: 1rem 2.1rem; font-size: 1.5rem; }

/* ---------------------------------------------------- pixel penguin sprites */
.peng {
  --delay: 0s;
  display: block;
  width: calc(30px * var(--px));
  height: calc(27px * var(--px));
  background-repeat: no-repeat;
  image-rendering: pixelated;
  flex: none;
}
@keyframes f3  { from { background-position-x: 0 } to { background-position-x: calc(-90px  * var(--px)) } }
@keyframes f4  { from { background-position-x: 0 } to { background-position-x: calc(-120px * var(--px)) } }
@keyframes f7  { from { background-position-x: 0 } to { background-position-x: calc(-210px * var(--px)) } }
@keyframes f8  { from { background-position-x: 0 } to { background-position-x: calc(-240px * var(--px)) } }
@keyframes f10 { from { background-position-x: 0 } to { background-position-x: calc(-300px * var(--px)) } }

/* walking, plus the jobs that happen to be four frames long */
.peng--walk-miner, .peng--walk-collector, .peng--walk-archaeologist,
.peng--walk-cultist, .peng--walk-hauler, .peng--walk-pumper, .peng--walk-sifter,
.peng--brush, .peng--haul, .peng--sift {
  background-size: calc(120px * var(--px)) calc(27px * var(--px));
  animation: f4 .58s steps(4) infinite var(--delay);
}
.peng--haul { animation-duration: .72s; }   /* a full sack is slower work */
.peng--sift { animation-duration: .66s; }
.peng--cast {
  background-size: calc(210px * var(--px)) calc(27px * var(--px));
  animation: f7 .95s steps(7) infinite var(--delay);
}
.peng--mine {
  background-size: calc(240px * var(--px)) calc(27px * var(--px));
  animation: f8 .8s steps(8) infinite var(--delay);
}
.peng--pump {
  background-size: calc(300px * var(--px)) calc(27px * var(--px));
  animation: f10 1s steps(10) infinite var(--delay);
}
.peng--fly-collector, .peng--fly-archaeologist, .peng--fly-cultist,
.peng--fly-hauler, .peng--fly-pumper, .peng--fly-sifter {
  background-size: calc(90px * var(--px)) calc(27px * var(--px));
  animation: f3 .42s steps(3) infinite var(--delay);
}

.peng--walk-miner         { background-image: url('/assets/miner-walk.png'); }
.peng--mine               { background-image: url('/assets/miner-mine.png'); }
.peng--walk-collector     { background-image: url('/assets/collector-walk.png'); }
.peng--fly-collector      { background-image: url('/assets/collector-fly.png'); }
.peng--walk-archaeologist { background-image: url('/assets/archaeologist-walk.png'); }
.peng--brush              { background-image: url('/assets/archaeologist-brush.png'); }
.peng--fly-archaeologist  { background-image: url('/assets/archaeologist-fly.png'); }
.peng--walk-cultist       { background-image: url('/assets/cultist-walk.png'); }
.peng--cast               { background-image: url('/assets/cultist-cast.png'); }
.peng--fly-cultist        { background-image: url('/assets/cultist-fly.png'); }
.peng--walk-hauler        { background-image: url('/assets/hauler-walk.png'); }
.peng--haul               { background-image: url('/assets/hauler-haul.png'); }
.peng--fly-hauler         { background-image: url('/assets/hauler-fly.png'); }
.peng--walk-pumper        { background-image: url('/assets/pumper-walk.png'); }
.peng--pump               { background-image: url('/assets/pumper-pump.png'); }
.peng--fly-pumper         { background-image: url('/assets/pumper-fly.png'); }
.peng--walk-sifter        { background-image: url('/assets/sifter-walk.png'); }
.peng--sift               { background-image: url('/assets/sifter-sift.png'); }
.peng--fly-sifter         { background-image: url('/assets/sifter-fly.png'); }

/* holding station in vacuum: the wings keep working while the penguin drifts */
.peng--drift {
  animation: f3 .42s steps(3) infinite var(--delay),
             drift var(--drift, 12s) ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) { .peng { animation: none; } }

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -3; }

.sun {
  position: absolute; z-index: -2;
  right: -12vw; top: -14vw;
  width: 46vw; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255,190,90,.20), rgba(255,122,26,.09) 38%, transparent 66%);
  pointer-events: none;
}

.orbit { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.orbit__stn { position: absolute; image-rendering: pixelated; opacity: .82; }
.orbit__stn--hub      { width: 7.25rem;  left: 7vw;  top: 24%; animation: drift 15s ease-in-out infinite; }
.orbit__stn--mines    { width: 5.5rem;   right: 9vw; top: 52%; animation: drift 19s ease-in-out infinite reverse; }
.orbit__stn--research { width: 3.875rem; left: 14vw; top: 63%; opacity: .5; animation: drift 24s ease-in-out infinite; }
/* the shuttle traffic between the three stations, kept clear of the sun glow */
.orbit__peng { position: absolute; --px: var(--px-far); --drift: 13s; }
.orbit__peng--hub      { left: 17vw;  top: 31%; }
.orbit__peng--mines    { right: 21vw; top: 57%; --drift: 11s; --delay: -.2s; }
.orbit__peng--research { left: 22vw;  top: 69%; --drift: 16s; --delay: -.1s; }
@keyframes drift {
  0%, 100% { transform: translateY(-.5625rem); }
  50%      { transform: translateY(.5625rem); }
}

.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(100% - 3rem, 73.75rem); margin-inline: auto;
  padding: 1.6rem 0;
}
.topbar__brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
}
.topbar__brand img { width: 2.2rem; height: 2.2rem; image-rendering: pixelated; }

.hero__inner {
  position: relative;
  text-align: center;
  padding: 3rem 1.5rem calc(var(--rise) + 2rem);
  width: min(100%, 48.75rem); margin-inline: auto;
}
.hero__inner h1 { margin: 0 0 1.8rem; }
.hero__inner h1 img {
  image-rendering: pixelated;
  width: clamp(16.875rem, 46vw, 28.75rem);
  margin-inline: auto;
  filter: drop-shadow(0 .5rem 1.875rem rgba(0,0,0,.7));
}
.hero__line {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.05rem, 2.5vw, 1.5rem);
  color: var(--ink);
  margin: 0 0 2.2rem;
}
.hero__meta {
  margin: 1.5rem 0 0;
  font-family: var(--display); font-size: .85rem; letter-spacing: .14em;
  text-transform: uppercase; color: #79808E;
}

/* the world: a circle big enough that only its horizon shows */
.planet {
  position: absolute; left: 50%;
  width: calc(var(--r) * 2); height: calc(var(--r) * 2);
  margin-left: calc(var(--r) * -1);
  bottom: calc(var(--rise) - var(--r) * 2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,122,26,.16), transparent 22%),
    url('/assets/tile-dirt.png') 0 0 / calc(32px * var(--px)) calc(32px * var(--px)) repeat,
    #17151A;
  background-blend-mode: normal, soft-light, normal;
  box-shadow: inset 0 .1875rem 0 rgb(141 82 49), 0 -1.875rem 5rem -1.25rem rgba(255,122,26,.04);
  image-rendering: pixelated;
}
.planet .peng {
  position: absolute; left: 50%; top: 50%;
  /* out to the rim, turned to stand on it, then sunk by the rim light plus
     the sprite's own 1px of empty space under the feet */
  transform:
    translate(-50%, -50%)
    rotate(var(--a))
    translateY(calc(var(--r) * -1))
    translateY(-50%)
    translateY(calc(.1875rem + 1px * var(--px)));
}

/* -------------------------------------------------------------------- beats */
.beat { position: relative; padding: clamp(5rem, 11vw, 8rem) 0; text-align: center; }
.beat .wrap { width: min(100% - 3rem, 48.75rem); }
.beat h2 { margin-bottom: 1.5rem; }
.beat p { color: var(--ink-dim); max-width: 47ch; margin-inline: auto; }
.beat__aside {
  display: inline-block;
  margin-top: 1.8rem; padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  font-family: var(--display); color: #79808E;
  max-width: 42ch;
}
/* drifting between orbit and the surface, which is what the wings are for */
.beat__peng      { position: absolute; left: max(2rem, 9vw); top: 34%; --drift: 11s; }
.beat__peng--far { left: auto; right: max(2rem, 9vw); top: 58%; --drift: 15s; --delay: -.24s; --px: var(--px-far); }
@media (max-width: 980px) { .beat__peng { display: none; } }

/* a lit crust running the width of the page, with a shift on it */
.beat--work, .get { --band: 11.875rem; }
.beat--work { padding-bottom: calc(var(--band) + 6rem); }
.beat--work::after, .get::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--band);
  background: url('/assets/tile-stone.png') 0 0 / calc(32px * var(--px)) calc(32px * var(--px)) repeat;
  opacity: .16;
  -webkit-mask-image: linear-gradient(180deg, #000 8%, transparent);
  mask-image: linear-gradient(180deg, #000 8%, transparent);
}
.crust { position: absolute; left: 0; right: 0; bottom: var(--band); height: .125rem; z-index: 1; }
.crust::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgb(140 138 138 / 0.5) 14%, rgb(90 91 95) 86%, transparent);
}
.crust .peng { position: absolute; bottom: 0; }

/* the space map — the same view the game gives you of the system.
   solar-map.js draws it; until it does, or if it never can, the box holds a
   plain sun so the section is never a hole in the page. */
.starmap {
  position: relative;
  width: min(48.75rem, 94vw);
  aspect-ratio: 640 / 500;         /* the window solar-map.js reads the map through */
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
  display: grid; place-items: center;
}
.starmap__gl { width: 100%; height: 100%; display: block; }
.starmap:not([data-ready])::after {
  content: ''; position: absolute;
  width: 21%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #FFF3D0, #FFC02E 52%, #FF7A1A);
  box-shadow: 0 0 6.875rem rgba(255,150,40,.42);
}
/* No penguin out here: nothing lands on a star, and nothing flies past one. */

@media (prefers-reduced-motion: reduce) {
  .orbit__stn { animation: none; }
}

/* --------------------------------------------------------------------- get */
.get {
  position: relative;
  padding: clamp(5rem, 11vw, 8rem) 0 calc(var(--band) + 5rem);
  text-align: center;
  border-top: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 120%, rgba(255,122,26,.15), transparent 62%);
}
.get h2 { margin-bottom: 1rem; }
.get > .wrap > p { color: var(--ink-dim); margin-bottom: 2.2rem; }
.get__actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.get__note {
  margin: 1.6rem 0 0;
  font-family: var(--display); font-size: .82rem; letter-spacing: .14em;
  text-transform: uppercase; color: #6B7280;
}

/* ------------------------------------------------------------------ footer */
.foot { border-top: 1px solid var(--line); padding-top: 3rem; }
.foot__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  width: min(100% - 3rem, 65rem);
  padding-bottom: 2.5rem;
}
.foot__credits { margin: 0; color: var(--ink-dim); font-size: .95rem; line-height: 1.9; }
.foot__credits b { color: var(--ink); font-family: var(--display); font-weight: 700; }
.foot__studio img { width: 10rem; opacity: .85; transition: opacity .2s; }
.foot__studio:hover img { opacity: 1; }
.foot__bar {
  width: min(100% - 3rem, 65rem);
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.foot__bar p { margin: 0; font-size: .82rem; color: #6B7280; }

/* ------------------------------------------------------------------- big
   The sprites are pixel art, so they step in whole numbers rather than
   riding the rem ramp: a 30x27 frame drawn at ×4 and ×5 on the wide panels
   the rest of the page is already growing into. */
@media (min-width: 1600px) { :root { --px: 4; --px-far: 3; } }
@media (min-width: 2400px) { :root { --px: 5; --px-far: 3; } }
@media (min-width: 3200px) { :root { --px: 6; --px-far: 4; } }

/* ------------------------------------------------------------------ small */
@media (max-width: 760px) {
  :root { --px: 2; --px-far: 2; --rise: max(7.5rem, 14vw); }
  .beat--work, .get { --band: 8.125rem; }
  .topbar { padding: 1.1rem 0; }
  /* keep the orbit clear of the wordmark and the button */
  .orbit__stn--hub { width: 4.25rem; left: 4vw; top: 11%; }
  .orbit__stn--mines { width: 3.5rem; right: 4vw; top: 74%; }
  .orbit__peng { display: none; }
  /* half the shift, so nobody stands on anyone */
  .planet .peng:nth-child(even), .crust .peng:nth-child(even) { display: none; }
  /* the map is a wide view; on a phone it is the width that is scarce */
  .starmap { width: 100%; }
}
