/* Seedbound website.
   Colours from the logo: night navy, sunshine yellow, lime, leaf green, the seed's brown, white pixel outlines.
   The pictures in img/ are made from the game's own sprites by tools/site_art.py. They are pixel art: they are only
   ever shown at whole-number sizes (--px is one art pixel on screen) with image-rendering: pixelated. */
:root {
  --night: #030542;        /* the logo's own navy, exactly: the top of every sky, so the logo's background disappears into it */
  --dusk: #1a1c86;
  --horizon: #3d41b4;
  --panel: #0a0c58;
  --panel-light: #14177a;
  --line: #2b2fa3;
  --shadow: #00001c;
  --yellow: #ffe83a;
  --lime: #a8f040;
  --leaf: #1e7a4a;
  --seed: #b8693a;
  --seed-light: #e0955a;
  --white: #ffffff;
  --text: #eef0ff;
  --muted: #b9bdea;
  --wrap: 1040px;
  --px: 2px;               /* one art pixel on screen */
  /* The logo is 128 x 48 art pixels (img/logo.png holds it at 6 to 1): it is only ever shown at a whole number of
     screen pixels to the art pixel, 2 on phones up to 6 on very wide screens. */
  --logo: 256px;
  --logo-h: calc(var(--logo) * 3 / 8);
  --logo-top: 24px;
}
@media (min-width: 420px) { :root { --logo: 384px; } }
@media (min-width: 700px) { :root { --logo: 512px; } }
@media (min-width: 1200px) and (min-height: 800px) { :root { --logo: 640px; } }
@media (min-width: 1800px) and (min-height: 950px) { :root { --logo: 768px; } }
@media (min-width: 1800px) { :root { --px: 3px; } }

* { box-sizing: border-box; }

html { background: var(--night); scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img { max-width: 100%; }
.pixel, .sky span, .feature .icon, .deep { image-rendering: crisp-edges; image-rendering: pixelated; }

a { color: var(--lime); }
a:hover { color: var(--yellow); }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: 16px; top: -60px; z-index: 20; padding: 8px 14px; background: var(--yellow); color: var(--night); font-weight: 800; }
.skip:focus { top: 8px; color: var(--night); }

/* ---- header ---- */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--night); box-shadow: 0 3px 0 var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { flex: none; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); font-weight: 900; font-size: 20px; letter-spacing: 0.5px; }
.brand:hover { color: var(--yellow); }
.brand img { display: block; max-width: none; width: 128px; height: 48px; }   /* logo-small.png: the logo at its own size */
.brand.no-logo img { width: 40px; height: 40px; }                  /* if it's missing: the game's icon and the name */
.brand:not(.no-logo) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 800; padding: 8px 12px; box-shadow: inset 0 -4px 0 transparent; }
.nav a:hover { color: var(--yellow); }
.nav a[aria-current="page"] { color: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow); }

/* ---- the scene: a night sky over a strip of the game's world ---- */
.scene {
  position: relative;
  overflow: hidden;
  text-align: center;
  /* The glow at the horizon is measured from the ground, so the top stays the logo's flat navy. */
  background: linear-gradient(to top, var(--horizon) calc(var(--land) - 10px), var(--dusk) calc(var(--land) + 150px), var(--night) calc(var(--land) + 380px));
  --land: calc(var(--px) * 64);    /* grass over soil */
  padding: var(--logo-top) 0 calc(var(--land) + var(--px) * 48 + 20px);
}
.scene-content { position: relative; z-index: 2; }
.sky { position: absolute; inset: 0; pointer-events: none; }
.sky span { position: absolute; display: block; }

/* The logo's plus-shaped sparkles, in two layers that take turns twinkling. */
.sky .stars { inset: 0 0 var(--land) 0; }
.sky .stars::before, .sky .stars::after { content: ""; position: absolute; inset: 0; }
.sky .stars::before { background: url(img/sparkles-a.png) 50% 0 / calc(var(--px) * 128) auto; animation: twinkle 5.2s steps(1) infinite; }
.sky .stars::after { background: url(img/sparkles-b.png) 30% 40px / calc(var(--px) * 104) auto; animation: twinkle 5.2s steps(1) -2.6s infinite; }
/* They thin out towards the horizon. On the home page they also leave the logo's box alone: the logo brings its own. */
.sky .stars {
  --fade: linear-gradient(to top, transparent 50px, #000 260px);
  -webkit-mask: var(--fade);
  mask: var(--fade);
}
.scene-hero:not(.no-logo) .stars {
  -webkit-mask: var(--fade), linear-gradient(#000 0 0) 50% var(--logo-top) / var(--logo) var(--logo-h) no-repeat;
  -webkit-mask-composite: xor;
  mask: var(--fade), linear-gradient(#000 0 0) 50% var(--logo-top) / var(--logo) var(--logo-h) no-repeat;
  mask-composite: exclude;
}

.sky .cloud {
  left: 0; width: calc(var(--px) * 64); height: calc(var(--px) * 32);
  background: url(img/clouds.png) 0 0 / calc(var(--px) * 192) calc(var(--px) * 32);
  opacity: 0.6;
  animation: drift 120s linear infinite;
}
.sky .cloud.c1 { bottom: calc(var(--land) + 215px); animation-duration: 150s; animation-delay: -30s; }
.sky .cloud.c2 { bottom: calc(var(--land) + 150px); background-position: calc(var(--px) * -64) 0; animation-duration: 110s; animation-delay: -75s; }
.sky .cloud.c3 { bottom: calc(var(--land) + 255px); background-position: calc(var(--px) * -128) 0; animation-duration: 180s; animation-delay: -120s; opacity: 0.45; }
.sky .cloud.c4 { bottom: calc(var(--land) + 120px); animation-duration: 135s; animation-delay: -8s; opacity: 0.45; }

.sky .hills { left: 0; right: 0; background-repeat: repeat-x; background-position: 50% 0; }
.sky .hills.far { height: calc(var(--px) * 160); bottom: calc(var(--land) - var(--px) * 34); background-image: url(img/hills-far.png); background-size: calc(var(--px) * 480) auto; }
.sky .hills.near { height: calc(var(--px) * 110); bottom: calc(var(--land) - var(--px) * 36); background-image: url(img/hills-near.png); background-size: calc(var(--px) * 480) auto; background-position: 30% 0; }

/* The props stand on the ground, centred: narrow screens see the middle of them. --shift (art pixels) moves them. */
.sky .stage {
  left: 50%; bottom: var(--land);
  width: calc(var(--px) * 768); height: calc(var(--px) * 128);
  margin-left: calc(var(--px) * (var(--shift, 0) - 384));
  background: url(img/hero-scene.png) 0 0 / 100% 100% no-repeat;
}
.sky .hopper {
  left: calc(var(--px) * 378); bottom: 0;
  width: calc(var(--px) * 32); height: calc(var(--px) * 48);
  background: url(img/hop.png) 0 0 / calc(var(--px) * 64) calc(var(--px) * 48) no-repeat;
  animation: hop 6s steps(1) infinite;
}
/* The fish tank's bubbles, as the game draws them: two streams of three beads (big, small, big), each bead rising
   one art pixel at a time from just over the sand to just under the surface. Places are in the scene's art pixels. */
.sky .bubble {
  left: calc(var(--px) * 217); bottom: calc(var(--px) * 9);
  width: calc(var(--px) * 4); height: calc(var(--px) * 4);
  background: url(img/bubbles.png) 0 0 / calc(var(--px) * 8) calc(var(--px) * 4) no-repeat;
  animation: rise 6s steps(40) infinite;
}
.sky .bubble.small { background-position: calc(var(--px) * -4) 0; }
.sky .bubble.n2 { animation-delay: -2s; }
.sky .bubble.n3 { animation-delay: -4s; }
.sky .bubble.s2 { left: calc(var(--px) * 248); animation-duration: 7.5s; animation-delay: -1s; }
.sky .bubble.s2.n2 { animation-delay: -3.5s; }
.sky .bubble.s2.n3 { animation-delay: -6s; }
.sky .land { left: 0; right: 0; bottom: 0; height: var(--land); background: url(img/ground.png) 50% 0 / calc(var(--px) * 32) auto repeat-x; }

@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rise { from { transform: none; } to { transform: translateY(calc(var(--px) * -40)); } }
@keyframes drift { from { transform: translateX(-200px); } to { transform: translateX(calc(100vw + 200px)); } }
/* Two hops, in whole art pixels, then a rest. */
@keyframes hop {
  0%, 62%, 78%, 94%, 100% { transform: none; background-position: 0 0; }
  64%, 76%, 80%, 92% { transform: translateY(calc(var(--px) * -5)); background-position: calc(var(--px) * -32) 0; }
  66%, 74%, 82%, 90% { transform: translateY(calc(var(--px) * -9)); background-position: calc(var(--px) * -32) 0; }
  68%, 72%, 84%, 88% { transform: translateY(calc(var(--px) * -12)); background-position: calc(var(--px) * -32) 0; }
  70%, 86% { transform: translateY(calc(var(--px) * -13)); background-position: calc(var(--px) * -32) 0; }
}

/* ---- the home page's hero ---- */
/* With the logo in place the sky stays the logo's flat navy down to the logo's bottom edge, and only then starts to
   glow: the logo's box never shows. (.no-logo is set by the page when img/logo.png is missing.) */
.scene-hero:not(.no-logo) {
  background: linear-gradient(to bottom, var(--night) calc(var(--logo-top) + var(--logo-h)), var(--dusk) calc(100% - var(--land) - 150px), var(--horizon) calc(100% - var(--land) + 10px));
}
/* --logo-tuck would pull the words up under the logo: the logo is cut close to its sparkles, so it stays at 0. */
.scene-hero .logo { display: block; width: var(--logo); height: var(--logo-h); max-width: none; margin: 0 auto calc(10px - var(--logo-tuck, 0px)); }
/* If img/logo.png is missing, the name in the logo's colours: yellow over lime over a leaf-green band, a white outline, a dark shadow. */
.wordmark {
  position: relative;
  display: inline-block;
  margin: 28px 0 22px;
  padding: 0 8px;
  font-size: clamp(52px, 15vw, 116px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  color: var(--yellow);
  background: linear-gradient(var(--yellow) 0 46%, var(--lime) 46% 76%, var(--leaf) 76%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(6px 6px 0 var(--shadow));
}
.pitch { margin: 0 auto 22px; max-width: 620px; font-size: clamp(18px, 2.4vw, 21px); line-height: 1.5; color: var(--white); text-shadow: 0 2px 0 var(--shadow), 0 0 12px var(--night); }
.hero-small { margin: 16px 0 0; color: #dfe2ff; font-size: 15px; text-shadow: 0 2px 0 var(--shadow); }

/* ---- the other pages' header: the same sky, lower ---- */
.scene-page { padding-top: 44px; padding-bottom: calc(var(--land) + var(--px) * 64 + 28px); --land: calc(var(--px) * 32); }
.scene-page .land { background-image: url(img/ground-thin.png); }
.scene-page h1 { margin: 0 0 10px; font-size: clamp(34px, 6vw, 52px); line-height: 1.1; font-weight: 900; color: var(--yellow); text-shadow: 3px 3px 0 var(--leaf), 6px 6px 0 var(--shadow); }
.scene-page .lead { margin: 0 auto; max-width: 540px; font-size: 18px; color: var(--white); text-shadow: 0 2px 0 var(--shadow), 0 0 12px var(--night); }

/* ---- buttons (pixel style: square, white outline, hard shadow) ---- */
.buttons { display: flex; gap: 14px 22px; justify-content: center; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  font: inherit; font-weight: 900; letter-spacing: 0.3px;
  text-decoration: none;
  color: var(--night);
  background: linear-gradient(var(--yellow) 0 62%, #f2c81e 62%);
  border: 3px solid var(--white);
  box-shadow: 5px 5px 0 var(--shadow);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { color: var(--night); background: linear-gradient(var(--lime) 0 62%, #86d02c 62%); transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--shadow); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--shadow); }
.btn.big { padding: 15px 34px; font-size: 21px; }
.more { font-weight: 800; color: var(--white); text-shadow: 0 2px 0 var(--shadow); }

/* ---- sections ---- */
main { flex: 1; }
section { padding: 44px 0; }
.scene + section { padding-top: 52px; }
h2 { position: relative; font-size: clamp(26px, 4vw, 34px); line-height: 1.2; font-weight: 900; margin: 0 0 22px; padding-left: 34px; color: var(--white); }
/* A sparkle before every heading: a plus of five 6 px squares. */
h2::before { content: ""; position: absolute; left: 6px; top: 0.6em; margin-top: -3px; width: 6px; height: 6px; background: var(--white); box-shadow: 0 -6px 0 var(--yellow), 0 6px 0 var(--yellow), -6px 0 0 var(--yellow), 6px 0 0 var(--yellow); }
h2 .accent { color: var(--yellow); }
h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; color: var(--yellow); }
p { margin: 0 0 14px; }
.panel > :last-child, .panel > div > :last-child { margin-bottom: 0; }

.panel { background: var(--panel); border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--shadow); padding: 22px; }

/* ---- Builder's pick ---- */
/* The picture is a photo of a whole world, one pixel to the art pixel (3200 x 1920 for SPLICED): far wider than the
   page, so the frame fills the page's width and the picture is shrunk to fit, whatever its shape. It is shrunk
   smoothly, not pixelated: nearest-pixel shrinking would drop the snow and make the blocks uneven. A click opens it
   full size. */
.pick { display: grid; gap: 6px; }
.pick-text { order: -1; }
.pick-frame { width: 100%; margin: 0; background: var(--panel); border: 4px solid var(--white); box-shadow: 0 0 0 4px var(--shadow), 10px 10px 0 4px var(--shadow); }
.pick-frame a { display: block; }
.pick-frame img { display: block; width: 100%; height: auto; }
.pick-empty {
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  background: url(img/sparkles-a.png) 50% 50% / 256px auto, linear-gradient(to top, var(--dusk), var(--night) 70%);
  image-rendering: pixelated;
  color: var(--muted); font-weight: 800; letter-spacing: 0.5px;
}
.pick-empty span { max-width: 84%; padding: 6px 14px; background: var(--night); border: 3px dashed var(--line); text-align: center; line-height: 1.35; }
.pick-frame figcaption { padding: 10px 14px; border-top: 4px solid var(--white); color: var(--text); font-size: 15px; }
.pick-text h2 { margin-bottom: 12px; }
.pick-text p { color: var(--muted); margin-bottom: 20px; }

/* ---- features ---- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.feature { display: grid; grid-template-columns: 70px 1fr; gap: 16px; align-items: start; }
/* Each icon in a slot, like an item in the bag: a 32 px sprite at twice its size. */
.feature .icon { box-sizing: content-box; width: 64px; height: 64px; border: 3px solid var(--line); background: var(--night) url(img/features.png) 0 0 / 384px 64px no-repeat; }
.feature:nth-child(2) .icon { background-position: -64px 0; }
.feature:nth-child(3) .icon { background-position: -128px 0; }
.feature:nth-child(4) .icon { background-position: -192px 0; }
.feature:nth-child(5) .icon { background-position: -256px 0; }
.feature:nth-child(6) .icon { background-position: -320px 0; }
.feature p { color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; display: block; border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--shadow); }
.gallery figcaption { color: var(--muted); font-size: 15px; margin-top: 8px; }

.cta { text-align: center; padding: 30px 22px; }
.cta h2 { display: inline-block; margin-bottom: 10px; }
.cta p { color: var(--muted); margin-bottom: 20px; }

/* ---- download ---- */
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.download { display: flex; flex-direction: column; align-items: flex-start; }
.download h3 { font-size: 24px; }
.download .meta { color: var(--muted); font-size: 15px; margin-bottom: 18px; flex: 1; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.steps li { counter-increment: step; position: relative; padding-left: 52px; min-height: 36px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -3px; width: 36px; height: 36px;
  display: grid; place-items: center;
  font-weight: 900; color: var(--night);
  background: var(--lime); border: 3px solid var(--white); box-shadow: 3px 3px 0 var(--shadow);
}
.note { margin-top: 8px; border-left: 6px solid var(--yellow); background: var(--panel-light); padding: 10px 14px; }
.facts { display: grid; gap: 14px; margin: 0; }
.facts div { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; }
.facts dt { font-weight: 800; color: var(--yellow); }
.facts dd { margin: 0; }
code, kbd { font-family: ui-monospace, Consolas, "Courier New", monospace; background: var(--panel-light); border: 2px solid var(--line); padding: 1px 6px; font-size: 0.92em; white-space: nowrap; }
kbd { border-bottom-width: 4px; color: var(--white); }

/* ---- community ---- */
.links { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.links:empty { display: none; }
.links a { display: block; text-decoration: none; color: var(--white); font-weight: 800; font-size: 19px; }
.links a span { display: block; color: var(--muted); font-weight: 400; font-size: 15px; }
.links a:hover { color: var(--yellow); }
.empty { text-align: center; padding: 34px 22px; border-style: dashed; color: var(--muted); }
.empty strong { display: block; margin-bottom: 4px; font-size: 20px; color: var(--white); }

/* ---- footer: the bottom of every world, bedrock over lava ---- */
.site-footer { margin-top: 28px; color: var(--muted); font-size: 15px; background: linear-gradient(to top, #3a1420, var(--night) 170px); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--yellow); }
.deep { height: calc(var(--px) * 44); background: url(img/deep.png) 50% 0 / calc(var(--px) * 32) auto repeat-x; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  section { padding: 34px 0; }
  .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  /* logo-seed.png: the logo's seed at twice its size (the margins take in the clear edges of its 64 px square). */
  .brand img { width: 64px; height: 64px; margin: -2px -10px; }
  .brand.no-logo img { margin: 0; }
  .nav a { padding: 8px 7px; }
  .panel { padding: 18px; }
  .feature { gap: 14px; }
  .facts div { grid-template-columns: 1fr; }
  .btn.big { padding: 14px 20px; font-size: 19px; }
  .download .btn { width: 100%; }
  .steps li .note { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .sky .stars::before, .sky .stars::after, .sky .hopper { animation: none; }
  /* The bubbles stop where they are, spread up their streams. */
  .sky .bubble { animation-play-state: paused; }
  /* The clouds stay where a moment of their drift would have put them. */
  .sky .cloud { animation: none; }
  .sky .cloud.c1 { left: 12%; } .sky .cloud.c2 { left: 68%; } .sky .cloud.c3 { left: 84%; } .sky .cloud.c4 { left: 30%; }
}
