/* The Sunny Street page: one till receipt for the street, printed down the middle of the game's sky. The game is
   itemised with its real prices and incomes and totals $0.00, free to play; the game's pictures lie beside the
   paper, its sprites are printed on the lines. On a phone the whole page is one strip of paper. */
@font-face { font-family: "Lilita One"; src: url("fonts/LilitaOne.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/Fredoka.woff") format("woff"); font-weight: 300 700; font-display: swap; }     /* (both cut down to Latin, see README) */

:root {
	--sky: #4fb8ff;          /* the field: the game's sky */
	--paper: #fff;           /* the till roll */
	--ink: #2a2440;          /* type, cut lines, the till's mouth, every outline */
	--sun: #ffd23f;          /* the TOTAL band */
	--orange: #c84d06;       /* FREE TO PLAY and the takings: the game's name-tag orange, deep enough to read on paper */
	--green: #58c462; --green-d: #4caf56;      /* UPGRADE, as in the game */
	--roll: 480px;           /* the width of the paper */
	--gutter: 64px;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--sky); color: var(--ink); font: 18px/1.5 "Fredoka", system-ui, sans-serif; }
main { overflow-x: clip; }
a { color: inherit; text-underline-offset: 0.15em; }
img { display: block; max-width: 100%; height: auto; }
/* Keyboard focus, selected text and the scrollbar in the receipt's colours. */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--sun); color: var(--ink); }
html { scrollbar-color: var(--ink) var(--sky); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- the shop's top line, and the till's mouth the paper comes out of as you scroll */
.top { display: flex; justify-content: space-between; align-items: center; padding: 20px var(--gutter) 14px; font: 22px "Lilita One"; }
.top a { text-decoration: none; }
.top nav a { margin-left: 26px; }
.mouth { position: sticky; top: 0; z-index: 5; width: calc(var(--roll) + 64px); height: 22px; margin: 0 auto -8px; background: var(--ink); border-radius: 0 0 14px 14px; }

/* ---- every band of the page: a side on the left, the paper in the middle, a side on the right */
.band { display: grid; grid-template-columns: minmax(0, 1fr) var(--roll) minmax(0, 1fr); column-gap: 56px; padding: 0 var(--gutter); }
.slip { background: var(--paper); padding: 40px 40px 44px; }
.band + .band .slip { display: flex; flex-direction: column; justify-content: center; }      /* (a section sits in the middle of its stretch of paper, with paper feeding above and below) */
.side { width: 100%; padding: 72px 0; }      /* (the full column, up to its cap: the fan has no width of its own) */
.side.l { justify-self: end; max-width: 420px; text-align: right; }
.side.r { justify-self: start; max-width: 440px; }
.big { font: 52px/0.98 "Lilita One"; letter-spacing: -0.01em; margin: 0 0 20px; text-wrap: balance; }
h2.big { font-size: 52px; }
.say { font-size: 20px; margin: 0; text-wrap: pretty; }

/* ---- the receipt's own grammar: centred small print, dashed cut lines, a quantity / item / amount grid */
h1 { margin: 0; }
.logo { width: 280px; margin: 0 auto 8px; }
.c { text-align: center; }
.fine { font-size: 15px; margin: 0; }
.cut { border: 0; border-top: 3px dashed var(--ink); margin: 18px 0; }
.hd { font: 26px/1.1 "Lilita One"; text-align: center; margin: 0; letter-spacing: 0.02em; }
.hd.thanks { font-size: 22px; }
.line { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 4px 0; }
.line b { font-weight: 600; }
.line small { display: block; font-size: 15px; line-height: 1.35; }
.amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.line.pic { grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; }
.line.pic > img { width: 72px; }
/* the game's sprites printed under a line: all ten fit the paper, however narrow */
.row { display: flex; margin-top: 6px; }
.row img { flex: 1 1 0; min-width: 0; max-width: 46px; margin-right: -3px; }
.row.faces img { max-width: 40px; margin-right: -4px; }
.row.marks img { max-width: 52px; margin-right: 2px; }
.row .truck { flex: none; width: 76px; max-width: none; }
.stars { display: inline-block; height: 18px; vertical-align: middle; background: url("img/sprites/star.webp") 0 50% / 19px 18px repeat-x; }
.n1 { width: 19px; } .n2 { width: 38px; } .n3 { width: 57px; } .n4 { width: 76px; } .n5 { width: 95px; }
/* lines not yet printed are faint, and print as they come out of the till (only with script, and not with reduced motion) */
.printing .print { opacity: 0.25; translate: 0 -6px; transition: opacity 0.45s ease-out, translate 0.45s var(--ease); }
.printing .print.on { opacity: 1; translate: none; }
.total { display: flex; justify-content: space-between; align-items: center; margin: 6px -14px 0; padding: 14px; font: 30px "Lilita One"; background: var(--sun); border-radius: 12px; }
.total strong { font: 72px/1 "Lilita One"; font-weight: 400; }
.free { margin: 8px 0 18px; font: 28px/1 "Lilita One"; color: var(--orange); text-align: right; }
.badge { display: block; width: 230px; margin: 0 auto 6px; }
.badge img { width: 100%; }
.soon { width: 230px; margin: 0 auto 6px; padding: 16px 0; font: 30px/1 "Lilita One"; text-align: center; border: 4px dashed var(--ink); border-radius: 12px; }      /* (where the Google Play badge goes at launch) */

/* ---- beside the first slip: what one stand makes while you read, and three screenshots fanned out */
.ticker { font-size: 18px; margin: 0 0 16px; max-width: 30ch; }
.ticker b { display: block; font: 54px/1 "Lilita One"; font-weight: 400; font-variant-numeric: tabular-nums; }
.fan { position: relative; height: 600px; width: 100%; max-width: 380px; }
.fan .shot { position: absolute; width: 52%; }
.fan .shot:nth-child(1) { left: 0; top: 50px; rotate: -8deg; }
.fan .shot:nth-child(2) { left: 24%; top: 0; z-index: 1; }
.fan .shot:nth-child(3) { left: 48%; top: 60px; rotate: 8deg; }

/* ---- the screenshots: each one a link to its picture, opened full size with script */
.shot { display: block; border-radius: 22px; cursor: zoom-in; }
.shot img { width: 100%; border-radius: 22px; border: 5px solid var(--ink); background: var(--ink); transition: translate 0.25s var(--ease); }
.shot:hover img { translate: 0 -6px; }
.shot:focus-visible { outline-offset: 4px; border-radius: 26px; }
.shots { display: grid; gap: 22px; }
.shots .shot { width: 240px; }
.side.l .shots .shot { margin-left: auto; }
.shots .shot:nth-child(2) { margin-top: -40px; translate: -70px 0; }
.shots.one { margin-top: 40px; }
.phone-only { display: none; }

/* ---- the trailer beside "what you get", and the till keys under it */
.phone { width: 300px; margin-left: auto; }
.phone video { width: 100%; height: auto; display: block; border-radius: 30px; border: 6px solid var(--ink); background: #000; }
.keys[hidden], .takings[hidden], .up[hidden], .tag[hidden], .ticker[hidden] { display: none; }
.keys { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.key { min-height: 44px; font: 18px "Lilita One"; color: var(--ink); background: var(--paper); border: 4px solid var(--ink); border-radius: 10px; padding: 6px 16px 8px; cursor: pointer; }
.key:hover { background: var(--ink); color: var(--paper); }

/* ---- the lemonade stand: tap it, upgrade it; its five looks are the five lines, the one it has is printed in full */
.levels .line { grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; }
.levels .line:not(.now) { opacity: 0.66; }
.levels .line.now { font-size: 20px; }
.takings { display: flex; justify-content: space-between; align-items: center; font: 26px "Lilita One"; }
.takings b { display: flex; align-items: center; gap: 10px; font: 52px/1 "Lilita One"; font-weight: 400; color: var(--orange); }
.takings b img { width: 40px; }
.up { display: block; width: 100%; margin-top: 18px; padding: 10px 0 13px; font: 28px "Lilita One"; color: var(--ink); background: var(--green); border: 4px solid var(--ink); border-radius: 12px; cursor: pointer;
	-webkit-text-stroke: 1.4px var(--ink); paint-order: stroke fill; }
.up:hover { background: var(--green-d); }
.up:active { translate: 0 3px; }
.stand { position: relative; display: block; width: 100%; max-width: 440px; padding: 0; border: 0; background: none; cursor: pointer; }
.stand img { width: 100%; transition: scale 0.25s var(--ease); }
.stand img.grew { scale: 1.06; }
.stand:active img { scale: 0.96; }
.stand:focus-visible { outline-offset: 6px; }
.tag { position: absolute; left: 0; top: 46%; font: 24px/1 "Lilita One"; background: var(--paper); border: 4px solid var(--ink); border-radius: 10px; padding: 6px 12px 8px; pointer-events: none; }
.plus { position: absolute; z-index: 2; pointer-events: none; translate: -50% -50%; white-space: nowrap; font: 34px/1 "Lilita One"; color: #fff;
	-webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); animation: rise 0.9s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } to { opacity: 0; transform: translateY(-80px); } }

/* ---- the end of the roll: torn off */
.slip.end { position: relative; padding-bottom: 56px; }
.slip.end::after { content: ""; position: absolute; left: 0; right: 0; bottom: -16px; height: 16px;
	background: linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 24px 16px, linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 24px 16px; }
.cafe { width: 100%; max-width: 440px; }
footer { padding: 96px var(--gutter) 48px; text-align: center; font-size: 16px; }
footer p { margin: 0; }

/* ---- a screenshot at full size, over the page */
.viewer { inset: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; padding: 24px 96px; border: 0; background: transparent; overflow: hidden; }
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: rgba(42, 36, 64, 0.9); }
.viewer img { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 48px); border-radius: 26px; border: 5px solid var(--paper); background: #000; }
.viewer[open] img { animation: zoom-in 0.3s var(--ease); }
@keyframes zoom-in { from { opacity: 0; scale: 0.94; } }
.viewer .key { position: absolute; width: 52px; height: 52px; padding: 0; display: grid; place-items: center; }
.viewer .key svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.v-close { top: 18px; right: 18px; }
.v-prev, .v-next { top: calc(50% - 26px); }
.v-prev { left: 18px; } .v-next { right: 18px; }
.v-prev svg { scale: -1 1; }

/* ---- on a phone, between the first badge and the last: the game and its badge, held at the foot of the screen */
.dock[hidden] { display: none; }
.dock { position: fixed; z-index: 10; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
	padding: 8px 6px 8px 10px; background: var(--paper); border: 4px solid var(--ink); border-radius: 14px;
	transform: translateY(calc(100% + 40px)); visibility: hidden; transition: transform 0.4s var(--ease), visibility 0s linear 0.4s; }
.dock.show { transform: none; visibility: visible; transition: transform 0.4s var(--ease); }
.dock > img { width: 48px; height: 48px; flex: none; border-radius: 12px; }
.dock p { flex: 1; min-width: 0; margin: 0; line-height: 1.15; }
.dock b { display: block; font: 20px "Lilita One"; font-weight: 400; }
.dock span { font-size: 14px; }
.dock .badge { width: 140px; margin: 0; }
@media (min-width: 901px) { .dock { display: none; } }

@media (max-width: 1180px) { :root { --gutter: 32px; --roll: 440px; } .big { font-size: 48px; } h2.big { font-size: 42px; } .shots .shot { width: 200px; } }

/* on a phone the whole page is one strip of paper: what stood beside it is printed into it, headings first */
@media (max-width: 900px) {
	:root { --gutter: 12px; --roll: 100%; }
	html { scroll-padding-bottom: 110px; }      /* (a focused control never ends up under the install bar) */
	.top { padding: 16px 20px 12px; }
	.mouth { width: calc(100% - 12px); }
	.band { grid-template-columns: minmax(0, 1fr); }
	.band > .side, .band > .slip { margin: 0; padding: 28px 22px; max-width: none; justify-self: stretch; text-align: left; background: var(--paper); }
	.side { padding-top: 32px; padding-bottom: 8px; }
	.band .side.l { order: 0; } .band .slip { order: 1; } .band .side.r { order: 2; }
	.band.head-r .side.r { order: -1; padding-bottom: 0; }
	.order-first .slip { order: -1; } .order-first .side.l { padding-bottom: 28px; }      /* (the order, its total and the badge on the first screen; the statement after them) */
	h2.big { font-size: 38px; }
	.till { display: none; }      /* (the logo and the statement already say it on the first screen) */
	.logo { width: 200px; }
	.big { font-size: 34px; }
	.fan { height: auto; aspect-ratio: 1 / 1.15; max-width: 400px; margin: 0 auto; }      /* (its height follows its width, so the cards stay inside) */
	.phone { margin: 0 auto; width: 260px; }
	.shots { grid-auto-flow: column; justify-content: start; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -22px; padding-inline: 22px; scroll-padding-inline: 22px; }      /* (the row runs to the paper's edge) */
	.phone-only { display: block; }
	.shots.one { display: none; }      /* (shot 6 joins the row above instead) */
	.shots .shot, .side.l .shots .shot { width: 64vw; max-width: 260px; margin: 0; translate: none; scroll-snap-align: start; }
	.shots .shot:nth-child(2) { margin-top: 0; }
	.slip { padding: 24px 22px; }
	.total strong { font-size: 60px; }
	.tag { top: 40%; }
	.stand-first .side.r { order: 1; } .stand-first .slip { order: 2; }      /* (the stand before its lines and keys) */
	.stand, .cafe { margin-inline: auto; max-width: 320px; }
	.stand-first .side.r { padding-top: 0; }
	.stand-first .stand { margin-top: -24px; }      /* (the stand's picture keeps room above it for the five-star café; taken back with a margin, never so far that the café's roof reaches the words) */
	.band + .band .slip { justify-content: flex-start; }
	main > .band:last-child > .side.r { display: none; }      /* (no café on a phone: the roll ends on its thanks) */
	/* the roll is torn off at the foot of its last band */
	.slip.end::after { display: none; }
	main > .band:last-child { position: relative; }
	main > .band:last-child::after { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); bottom: -16px; height: 16px;
		background: linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 24px 16px, linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 24px 16px; }
	footer { padding-bottom: 120px; }      /* (room for the install bar) */
}
@media (max-width: 600px) {
	.viewer { padding: 76px 12px 92px; }
	.v-prev, .v-next { top: auto; bottom: 22px; }
	.v-prev { left: calc(50% - 68px); } .v-next { right: calc(50% - 68px); }
}

@media (prefers-reduced-motion: reduce) {
	.shot img, .stand img, .dock { transition: none; }
	.viewer[open] img { animation: none; }
	.plus { display: none; }
}
