/* Sprout Pop website. A snowy valley at dusk, whose snow carries on down the page. Text pages open like the game's popups, a
   plaque on a leafy window. */

@font-face {
  font-family: "Lilita One";
  src: url("../fonts/LilitaOne-Regular.woff") format("woff");
  font-display: swap;
}

:root {
  --dusk: #2a2a7c;
  --dusk-deep: #1b1a5a;
  --snow: #858bdc;
  --snow-dusk: #6468c8;
  --bark: #4a250e;
  --bark-soft: #6a4225;
  --cream: #fff6e2;
  --cream-edge: #ecd7ab;
  --pollen: #ffc531;
  --link: #1f6a12;

  --display: "Lilita One", ui-rounded, system-ui, sans-serif;
  --text: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --frame: 44px;
}

@media (min-width: 700px) {
  :root { --frame: 72px; }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--dusk-deep);
  color: var(--bark);
  font: 400 1.0625rem/1.6 var(--text);
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--bark);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--pollen);
  border-radius: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Cream letters with a brown outline, as the game's titles. A text shadow, since a stroke would eat into the letters. */
.display {
  --ink: var(--bark);
  margin: 0;
  color: var(--cream);
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.08;
  text-shadow:
    .045em 0 0 var(--ink), -.045em 0 0 var(--ink), 0 .045em 0 var(--ink), 0 -.045em 0 var(--ink),
    .032em .032em 0 var(--ink), -.032em .032em 0 var(--ink), .032em -.032em 0 var(--ink), -.032em -.032em 0 var(--ink),
    0 .1em 0 var(--ink), .03em .09em 0 var(--ink), -.03em .09em 0 var(--ink);
}

/* ---------- The snowy valley ---------- */

.scene {
  position: relative;
  overflow: hidden;
  background: var(--snow) url("../img/scene-900.webp") 50% 0 / 900px auto no-repeat;
  background-image: image-set(url("../img/scene-900.webp") 1x, url("../img/scene-2048.webp") 2x);
}

/* Dusk behind the words, so that they stay readable on the snow. The painted scene ends lower down on a tall page, and the
   snow carries on in its own colour. */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(32, 30, 110, 0) 150px, rgba(32, 30, 110, .5) 240px, rgba(32, 30, 110, .5) 400px, rgba(32, 30, 110, 0) 560px),
    linear-gradient(180deg, transparent 400px, var(--snow) 575px);
}

.hero {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px var(--gutter) 40px;
}

.hero-copy {
  position: relative;
  width: 100%;
  max-width: 36rem;
  text-align: center;
}

.logo {
  width: min(300px, 80vw);
  margin: 0 auto;
  filter: drop-shadow(0 8px 16px rgba(20, 16, 70, .5));
}

.tagline {
  margin-top: 6px;
  font-size: clamp(1.55rem, 7vw, 2.4rem);
}

.pitch {
  max-width: 32rem;
  margin: 12px auto 0;
  color: #fff;
  font-size: 1.125rem;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(20, 16, 70, .6);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* Google's own badge. Its picture has clear space around the badge (41 of its 250 px height on every side), so it is drawn
   larger and pulled in. */
.badge {
  --badge: 56px;
  display: inline-block;
  border-radius: 10px;
  line-height: 0;
}

/* No max-width: the pulled-in margins make the link narrower than the picture, and the picture would be squeezed to fit it. */
.badge img { width: auto; max-width: none; height: var(--badge); }

.badge.google img {
  height: calc(var(--badge) * 250 / 168);
  margin: calc(var(--badge) * -41 / 168);
}

.hero-board {
  width: min(100%, 460px);
  margin: 22px 0 0;
}

/* The hedgehog waits in the snow beside the board, where there is room for him. */
.hero-hedgehog { display: none; }

/* On a computer the board lies on the snow field, so the scene keeps the field's far edge just behind the board's arch at
   every width: the picture's field starts 19 % down. */
@media (min-width: 900px) {
  .scene {
    background-image: url("../img/scene-2048.webp");
    background-size: max(100%, 1500px) auto;
    background-position: 50% min(-75px, calc(210px - 19vw));
  }

  .scene::after {
    background:
      linear-gradient(180deg, transparent 62%, var(--snow) 100%),
      linear-gradient(100deg, rgba(27, 26, 90, .62) 0, rgba(27, 26, 90, .46) 34%, rgba(27, 26, 90, 0) 56%);
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    gap: clamp(32px, 6vw, 96px);
    align-items: start;
    justify-items: start;
    padding-top: 0;
  }

  .hero-copy { padding-top: 26px; text-align: left; }
  .logo { width: 440px; margin: 0 0 0 -16px; }
  .pitch { margin-left: 0; font-size: 1.1875rem; }
  .stores { justify-content: flex-start; }
  .hero-board { width: 100%; margin: 168px 0 0; }
}

@media (min-width: 1100px) {
  .hero-hedgehog {
    display: block;
    position: absolute;
    right: calc(var(--gutter) + 400px + clamp(32px, 6vw, 96px) + 12px);
    bottom: 56px;
    width: 150px;
  }

  /* His shadow on the snow. */
  .hero-hedgehog::before {
    content: "";
    position: absolute;
    left: 2%;
    right: 12%;
    bottom: -12px;
    height: 34px;
    background: radial-gradient(closest-side, rgba(27, 26, 90, .5), rgba(27, 26, 90, 0));
  }

  .hero-hedgehog img { position: relative; width: 100%; max-width: none; }
}

/* ---------- The snow under the valley ---------- */

.field {
  position: relative;
  /* Carries on from the scene's own colour, and dusk falls towards the end of the page. */
  background: linear-gradient(180deg, var(--snow), var(--snow-dusk));
  padding-bottom: clamp(48px, 7vw, 88px);
}

/* The row runs edge to edge. Its first picture lines up with the text column, and the sides fade out where more pictures
   are hidden (--fade-left and --fade-right, set by assets/js/shots.js). */
.shots {
  --edge: max(var(--gutter), calc((100% - 1180px) / 2 + var(--gutter)));
  --fade-left: 0px;
  --fade-right: 56px;
  display: flex;
  gap: clamp(14px, 2.2vw, 24px);
  margin: 0;
  padding: 28px var(--edge) 44px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--edge);
  list-style: none;
  scrollbar-width: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
}

.shots::-webkit-scrollbar { display: none; }

/* Fingers swipe the row natively and land on a picture. */
@media (pointer: coarse) {
  .shots { scroll-snap-type: x mandatory; }
}

/* A mouse grabs the row and swipes it. */
@media (hover: hover) and (pointer: fine) {
  .shots { cursor: grab; }
}

.shots.is-dragging { cursor: grabbing; }

.shots li { flex: 0 0 auto; scroll-snap-align: start; }

.shots img {
  width: clamp(200px, 22vw, 260px);
  height: auto;
  aspect-ratio: 400 / 869;
  border: 4px solid var(--cream);
  border-radius: 24px;
  background: var(--dusk);
  box-shadow: 0 6px 0 rgba(27, 26, 90, .4), 0 18px 34px rgba(27, 26, 90, .4);
  -webkit-user-drag: none;
}

/* ---------- The game's popup: a plaque on a leafy window ---------- */

.popup {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(4px, 2vw, 24px);
}

.plaque {
  position: relative;
  z-index: 1;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto -38px;
  border-style: solid;
  border-width: 26px 54px 28px;
  border-image: url("../img/plaque.webp") 72 124 76 fill / 26px 54px 28px stretch;
  color: var(--cream);
  font: 400 clamp(1.45rem, 5.4vw, 2.1rem)/1.1 var(--display);
  text-align: center;
  letter-spacing: .01em;
  text-shadow: 0 .05em 0 var(--bark), .04em 0 0 var(--bark), -.04em 0 0 var(--bark), 0 -.04em 0 var(--bark), 0 .1em 0 var(--bark);
}

.plaque span { display: block; padding: 2px 6px 4px; }

/* The shop's window stretches from a sprite whose corners keep their leaves. Its cream starts a third of the way into the
   frame, so the text may reach a little into the frame at the sides, where there are no leaves. */
.window {
  border-style: solid;
  border-width: var(--frame);
  border-image: url("../img/window.webp") 152 fill / var(--frame) stretch;
  /* The same cream behind the sprite, reaching under the frame, so that no hair of the page shows where its slices meet. */
  background: linear-gradient(#fcf2d8, #fcf2d8) center / calc(100% - var(--frame) * 1.1) calc(100% - var(--frame) * 1.1) no-repeat;
  color: var(--bark);
}

.window-body {
  margin: -12px calc(var(--frame) * -.42);
  /* One line length for the whole text, about 66 characters, in the middle of the window. */
  padding-inline: max(0px, calc((100% - 44rem) / 2));
}

/* ---------- The points on the start page ---------- */

.fact-list {
  display: grid;
  gap: 18px clamp(20px, 3vw, 40px);
  margin: 18px calc(var(--frame) * -.36) 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 860px) {
  .fact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.fact-list li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.fact-list img { width: auto; max-width: 72px; height: auto; max-height: 72px; margin: 0 auto; }

.fact-list p { margin: 0; font-size: 1.0625rem; line-height: 1.42; }

.again {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(44px, 7vw, 80px) var(--gutter) 0;
  text-align: center;
}

.again > img { width: 96px; height: 96px; border-radius: 22%; border: 4px solid var(--cream); box-shadow: 0 6px 0 rgba(27, 26, 90, .4), 0 14px 24px rgba(27, 26, 90, .4); }

.again h2 { max-width: 20em; margin-top: 8px; font-size: clamp(1.75rem, 4.6vw, 2.6rem); text-wrap: balance; }

.again .stores { margin-top: 12px; }

/* ---------- Footer ---------- */

.footer {
  padding: 28px var(--gutter) 40px;
  background: var(--dusk-deep);
  color: rgba(255, 246, 226, .82);
  font-size: .9375rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
}

.footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer a { text-underline-offset: 3px; }
.footer p { margin: 0; }
.footer :focus-visible { outline-color: var(--cream); box-shadow: none; }
.footer .legal { flex-basis: 100%; color: rgba(255, 246, 226, .62); font-size: .8125rem; }

/* ---------- Text pages: support, privacy, terms ---------- */

.scene.slim .bar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 14px var(--gutter) 130px;
}

/* The window pulls the snow below up over the scene's last 58 px (.page .popup), so the fade ends there. */
.scene.slim::after { background: linear-gradient(180deg, transparent 60px, var(--snow) calc(100% - 58px)); }

.brand { display: block; border-radius: 12px; }
.brand img { width: 168px; filter: drop-shadow(0 6px 10px rgba(20, 16, 70, .5)); }

.page {
  margin-top: -1px;
  padding: 0 clamp(4px, 2vw, 24px) clamp(40px, 7vw, 80px);
}

.page .popup { max-width: 920px; margin-top: -58px; padding: 0; }

.window > .window-body > :first-child { margin-top: 0; }

.window .lead { margin-top: .25rem; color: var(--bark-soft); font-size: 1.1875rem; line-height: 1.5; }

.window h2 {
  margin: 2em 0 .45em;
  color: var(--bark);
  font: 400 1.6rem/1.15 var(--display);
}

.window h3 { margin: 1.5em 0 .3em; color: var(--bark); font-size: 1.125rem; line-height: 1.3; }

.window ul { padding-left: 1.25em; }
.window li + li { margin-top: .35em; }
.window a { color: var(--link); text-underline-offset: 3px; }

.meta { color: var(--bark-soft); font-size: .9375rem; text-align: center; }

.notice {
  padding: 14px 18px;
  border: 2px solid var(--cream-edge);
  border-radius: 16px;
  background: #fff0c8;
}

.table-wrap { margin: 1em 0 .5em; overflow-x: auto; }

.window table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.45;
}

.window th, .window td {
  padding: 10px 12px 10px 0;
  border-bottom: 2px solid var(--cream-edge);
  text-align: left;
  vertical-align: top;
}

.window th { font-weight: 700; }

.faq details {
  padding: 2px 0;
  border-bottom: 2px solid var(--cream-edge);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  color: var(--bark);
  font: 400 1.3rem/1.2 var(--display);
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #1f7a12;
  border-radius: 50%;
  background: linear-gradient(#7dd02c, #3f9e16);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  text-shadow: 0 1px 0 #1f6a12;
  transition: rotate .2s ease;
}

.faq details[open] summary::after { rotate: 45deg; }

.faq details > :not(summary) { margin-top: 0; }

.contact {
  margin-top: 2.4em;
  padding: 20px 24px;
  border-radius: 18px;
  background: #e9f4cf;
}

.contact h2 { margin-top: 0; }

/* The shop's green button, which keeps its round ends when it stretches. */
.button {
  display: inline-block;
  border-style: solid;
  border-width: 14px 30px;
  border-image: url("../img/button-green.webp") 56 60 fill / 14px 30px stretch;
  font: 400 1.25rem/1.1 var(--display);
  text-decoration: none;
  text-shadow: 0 .06em 0 #1f6a12, .04em 0 0 #1f6a12, -.04em 0 0 #1f6a12, 0 -.04em 0 #1f6a12;
}

.window a.button { color: #fff; }

.window-body.center { text-align: center; }

/* The error page is a small card, with the hedgehog in it. */
.popup.short { max-width: 620px; padding-bottom: 8px; }
.lost { width: 150px; margin: 8px auto 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
