@font-face {
  font-family: 'Bushcraft One';
  src: url('/fonts/bushcraft_one.woff2') format('woff2'),
       url('/fonts/bushcraft_one.woff') format('woff');
  font-display: swap;
  /* pin the hhea metrics; Windows would use the 1000/0 win metrics and drop the text .25em */
  ascent-override: 75%;
  descent-override: 25%;
}
/* the slogan; latin subset from Google Fonts */
@font-face {
  font-family: 'Dosis';
  src: url('/fonts/dosis_extrabold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  /* the logo's rainbow, in mane order */
  --teal: #45d6ac;
  --cyan: #1bd1ff;
  --blue: #3072e1;
  --purple: #7d4eff;
  --gold: #ffb00b;
  --pink: #ee085f;
  --navy: #003696;   /* logo outline */
  --sky: #c9e1ff;    /* unicorn face */

  --ink: #1d2b4f;
  --muted: #5a6a8f;
  --paper: #f3f8ff;
  --accent: var(--purple);

  --display: 'Bushcraft One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --slogan: 'Dosis', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --cap-offset: .14em;  /* how far Bushcraft's caps sit above the middle of their line box */
  --rainbow: linear-gradient(90deg, var(--teal), var(--cyan), var(--blue), var(--purple), var(--gold), var(--pink));
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper) radial-gradient(var(--sky) 1.4px, transparent 1.5px) 0 0 / 24px 24px;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
.icon { flex: none; width: 1.2em; height: 1.2em; }
a { color: var(--purple); }
a:hover { color: var(--pink); }

:focus-visible { outline: 4px solid var(--cyan); outline-offset: 4px; }

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

.wrap { width: min(1120px, 100%); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }

/* Rainbow lines */
.lines { display: flex; height: 6px; }
.lines > span { flex: 1; transform-origin: left; }
.lines > span:nth-child(1) { background: var(--teal); }
.lines > span:nth-child(2) { background: var(--cyan); }
.lines > span:nth-child(3) { background: var(--blue); }
.lines > span:nth-child(4) { background: var(--purple); }
.lines > span:nth-child(5) { background: var(--gold); }
.lines > span:nth-child(6) { background: var(--pink); }
.lines.reverse { flex-direction: row-reverse; }
.lines.reverse > span { transform-origin: right; }

/* Footer */
.site-footer { margin-top: 72px; background: #fff; color: var(--muted); }
.site-footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-block: 28px 40px; font-size: .85rem; }

/* Buttons & pills */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  padding: calc(13px + var(--cap-offset)) 30px calc(13px - var(--cap-offset));
  border: 4px solid var(--navy);
  border-radius: 999px;
  box-shadow: 0 6px 0 var(--navy);
  text-shadow: 0 2px 0 rgb(0 0 0 / .25);
}
a.btn:hover { color: #fff; }
.btn .icon { width: 1.3em; height: 1.3em; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-family: var(--display);
  font-size: .95rem;
  line-height: 1;
  color: #fff;
  background: var(--accent);
  padding: calc(5.5px + var(--cap-offset)) 12px calc(5.5px - var(--cap-offset));
  border: 3px solid var(--navy);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--navy);
}
.pill .icon { width: 1.4em; height: 1.4em; margin-block: -.2em; }
/* labels are padded down by --cap-offset; icons rise back by the same */
.btn .icon, .pill .icon { translate: 0 calc(-1 * var(--cap-offset)); }

h1, h2 { font-family: var(--display); font-weight: normal; color: var(--navy); line-height: 1.05; }
h1 { font-size: clamp(2.4rem, 6.5vw, 3.7rem); }
h2 { font-size: clamp(2rem, 5vw, 2.6rem); }

/* Masthead: the unicorn facing the slogan's two lines */
.masthead {
  --head: clamp(100px, 20vw, 190px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.6vw, 32px);
  padding-block: clamp(28px, 6vw, 56px) clamp(24px, 4vw, 40px);
}
.unicorn {
  flex: none;
  width: var(--head);
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.unicorn img { filter: drop-shadow(0 8px 0 rgb(0 54 150 / .12)); transform-origin: 50% 85%; }  /* home.js dances it from the neck */

.slogan {
  position: relative;
  top: calc(var(--head) * .08);  /* the horn makes the image top-heavy: center on the face, ~58% down */
  font-family: var(--slogan);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 5.2vw, 3.9rem);
  line-height: .95;
  color: var(--navy);
}
.slogan span { white-space: nowrap; }
.slogan .line { display: block; }
/* home.js wraps each letter and gives it a mane color */
.slogan .ch {
  color: var(--c);
  -webkit-text-stroke: .07em var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--navy);
}
/* "MULTIPLAYER / GAMES." on phones, so the letters stay big beside the head */
@media (max-width: 599px) {
  .slogan { font-size: 9.4vw; }
  .slogan .line:last-child { white-space: normal; }
}

/* slogan.js draws the letters in 3D over the text, which stays for layout and screen readers */
.slogan { transition: opacity .3s; }
.slogan.is-3d {
  opacity: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;  /* a sideways swipe strums the letters instead of scrolling */
}
.slogan-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: calc(100% + 48px);  /* sparkles fall past the masthead */
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.slogan-canvas.on { opacity: 1; }

/* Featured: art beside the info once there's room */
@media (min-width: 820px) {
  .card.featured { flex-direction: row; }
  .card.featured .art { flex: 0 0 56%; border-bottom: 0; border-right: 4px solid var(--navy); }
  .card.featured .info { justify-content: center; padding: 28px 36px; }
}

/* Cards */
.games { margin-top: 56px; }
.games h2 { display: inline-block; margin-bottom: 20px; }
.games h2::after { content: ''; display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--rainbow); }

.grid { list-style: none; display: grid; gap: 28px; }
.grid > li { display: flex; }  /* cards in a row share the tallest height */
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; } }

.card {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --rot: 0deg;
  --s: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 4px solid var(--navy);
  border-radius: 22px;
  box-shadow: 0 8px 0 var(--navy);
  overflow: hidden;
  cursor: pointer;
  transform: perspective(900px) translateY(var(--lift)) rotate(var(--rot)) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  -webkit-tap-highlight-color: transparent;
}
.card:hover { color: var(--ink); }

.art { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--sky); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art.contain { background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--bg), #fff 22%), var(--bg) 70%); }
.art.contain img { object-fit: contain; padding: 4%; }
.card .art { border-bottom: 4px solid var(--navy); }

.card > .pill { position: absolute; top: 14px; left: 14px; z-index: 2; }

.card .info { position: relative; flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 16px 20px 20px; }
.card .name { font-family: var(--display); font-size: 1.75rem; line-height: 1.1; color: var(--navy); padding-right: 64px; margin-bottom: -.15em; }  /* all caps: trim the empty descender space */
.card .tagline { color: var(--muted); }
.card .dev { font-size: .8rem; color: var(--muted); opacity: .8; }

.play-badge {
  position: absolute;
  top: -34px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border: 4px solid var(--navy);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--navy);
}
.play-badge .icon { width: 32px; height: 32px; }

.card.featured .name { font-size: clamp(2rem, 5vw, 2.6rem); padding-right: 0; }
.card.featured .tagline { font-size: 1.1rem; }
.card.featured .info { gap: 6px; padding: 20px 24px 26px; }
.card.featured .pill { align-self: flex-start; margin-bottom: 4px; }
.card.featured .btn { align-self: flex-start; margin-top: 14px; padding-left: 23px; }  /* play.svg is blank left of the triangle */

/* Coming soon */
.art.blank {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent), var(--navy) 40%));
}
.art.blank::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: url('/images/logo/silhouette.png') 0 0 / 72px 72px;
  opacity: .14;
  rotate: -12deg;
}
.soon-name {
  position: relative;
  font-family: var(--display);
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  padding-top: calc(2 * var(--cap-offset));
  color: #fff;
  text-shadow: 0 5px 0 var(--navy);
  -webkit-text-stroke: 2px var(--navy);
  paint-order: stroke fill;
}
.ribbon {
  position: absolute;
  top: 32px;
  right: -57px;  /* band center on the corner's diagonal, so the label sits mid-band */
  z-index: 2;
  width: 220px;
  rotate: 45deg;
  font-family: var(--display);
  font-size: 1.05rem;
  text-align: center;
  color: #fff;
  background: var(--pink);
  padding: calc(5.5px + var(--cap-offset)) 0 calc(5.5px - var(--cap-offset));
  border-block: 3px solid var(--navy);
}
.bubble {
  position: absolute;
  top: 22%;
  left: 50%;
  z-index: 3;
  translate: -50% 0;
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--navy);
  background: #fff;
  padding: calc(5px + var(--cap-offset)) 20px calc(5px - var(--cap-offset));
  border: 4px solid var(--navy);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--navy);
  pointer-events: none;
}

/* Play page */
body.play {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0b1633;
  /* the header and the tray that drops out of it; the template picks data-bar at random */
  --bar: var(--blue);
  --bar-ink: #fff;
  --bar-wash: rgb(255 255 255 / .14);
  --bar-wash-hover: rgb(255 255 255 / .26);
}
body.play[data-bar='teal'] { --bar: var(--teal); }
body.play[data-bar='cyan'] { --bar: var(--cyan); }
body.play[data-bar='purple'] { --bar: var(--purple); }
body.play[data-bar='gold'] { --bar: var(--gold); }
body.play[data-bar='pink'] { --bar: var(--pink); }
/* white text is unreadable on the light ones */
body.play:is([data-bar='teal'], [data-bar='cyan'], [data-bar='gold']) {
  --bar-ink: var(--navy);
  --bar-wash: rgb(0 54 150 / .1);
  --bar-wash-hover: rgb(0 54 150 / .18);
}
.play-bar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: var(--bar);
  color: var(--bar-ink);
}
body.play .lines { position: relative; z-index: 6; height: 3px; }
.play-bar .home { flex: none; width: 30px; }
.play-bar .title {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  padding-top: calc(2 * var(--cap-offset));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.soon-pill { flex: none; font-size: .75rem; padding-inline: 8px; border-width: 2px; box-shadow: none; background: var(--pink); }
body.play:not([data-status='soon']) .soon-pill { display: none; }

.more-btn, .icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  font: 600 .85rem var(--body);
  color: var(--bar-ink);
  text-decoration: none;
  background: var(--bar-wash);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.more-btn { gap: 6px; padding: 0 12px 0 6px; }
.more-btn .icon { width: 22px; height: 22px; }
.more-btn::after {
  content: '';
  width: 6px;
  height: 6px;
  margin: -3px 0 0 2px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  rotate: 45deg;
  transition: rotate .25s var(--spring), margin .25s;
}
.more-btn[aria-expanded='true']::after { rotate: 225deg; margin-top: 3px; }
.more-btn:hover, .icon-btn:hover { color: var(--bar-ink); background: var(--bar-wash-hover); }
.more-btn[aria-expanded='true'] { color: var(--navy); background: #fff; }
.icon-btn { position: relative; width: 30px; }
.icon-btn[hidden] { display: none; }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn::after {
  content: attr(aria-label);
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  font: 600 .75rem var(--body);
  white-space: nowrap;
  color: var(--navy);
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--navy);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.icon-btn:hover::after, .icon-btn:focus-visible::after { opacity: 1; }
@media (max-width: 479px) { .soon-pill { display: none; } }
@media (max-width: 374px) {
  .play-bar { gap: 6px; }
  .more-btn { padding: 0 10px 0 5px; }
  .more-btn .wide { display: none; }
}

/* the "More games" tray drops over the game */
.more {
  position: absolute;
  top: 43px;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 14px max(12px, env(safe-area-inset-left)) 18px;
  background: var(--bar);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 16px 32px rgb(0 0 0 / .35);
  visibility: hidden;
  opacity: 0;
  translate: 0 -10px;
  transition: opacity .2s, translate .35s var(--spring), visibility .2s;
}
.more.open { visibility: visible; opacity: 1; translate: 0 0; }
.more ul {
  list-style: none;
  display: flex;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 4px 8px;
}
.more li { flex: 0 0 168px; scroll-snap-align: start; }
.mini { display: flex; flex-direction: column; gap: 2px; color: var(--bar-ink); text-decoration: none; }
.mini:hover { color: var(--bar-ink); }
.mini .art { border: 3px solid #fff; border-radius: 12px; margin-bottom: 6px; box-shadow: 0 4px 0 rgb(0 0 0 / .3); }
.mini .soon-name { font-size: 1.3rem; -webkit-text-stroke-width: 1.5px; text-shadow: 0 3px 0 var(--navy); }
.mini-name { font-family: var(--display); font-size: 1rem; line-height: 1.1; padding-top: var(--cap-offset); }
.mini-tag { font-size: .72rem; font-weight: 600; color: color-mix(in srgb, var(--bar-ink) 70%, transparent); }
.mini[aria-disabled='true'] { cursor: default; opacity: .7; }

.stage { position: relative; flex: 1; background: #0b1633; }
.stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.scrim { position: absolute; inset: 0; background: rgb(11 22 51 / .6); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: var(--display);
  font-size: 1.4rem;
  color: #fff;
  background: #0b1633;
  transition: opacity .4s, visibility .4s;
}
.loader img { width: 120px; }
.stage.loaded .loader { opacity: 0; visibility: hidden; }

/* 404 */
body.lost main { min-height: calc(100vh - 6px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding-block: 32px; }
body.lost .bob-button { padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
body.lost .bob { width: clamp(140px, 35vw, 220px); }
body.lost main h1 { margin-bottom: 16px; }

/* Juice — only for people who haven't asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  .lines > span { animation: grow .7s var(--spring) both; }
  .lines > span:nth-child(2) { animation-delay: .06s; }
  .lines > span:nth-child(3) { animation-delay: .12s; }
  .lines > span:nth-child(4) { animation-delay: .18s; }
  .lines > span:nth-child(5) { animation-delay: .24s; }
  .lines > span:nth-child(6) { animation-delay: .30s; }

  .bob, .loader img { animation: bob 3.2s ease-in-out infinite; }
  .unicorn.boing { animation: boing .8s var(--spring); }

  .grid > li { animation: pop .6s var(--spring) both; animation-delay: calc(var(--i) * 90ms + .2s); }

  .card { transition: transform .45s var(--spring), box-shadow .45s var(--spring); }
  .card.tilting { transition-duration: .12s, .45s; }
  .card .art img { transition: scale .6s var(--spring); }
  .play-badge { transition: scale .4s var(--spring), rotate .4s var(--spring); }
  .art.blank::before { animation: pan 30s linear infinite; }
  .card.wiggle { animation: wiggle .5s ease-in-out; }
  .bubble { animation: bubble 1.1s var(--spring) both; }

  .btn { transition: transform .35s var(--spring), box-shadow .35s var(--spring); }
  .btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 4px solid var(--accent);
    border-radius: inherit;
    animation: ring 2s ease-out infinite;
    pointer-events: none;
  }

  .play-bar .home img, .mini .art { transition: rotate .35s var(--spring), scale .35s var(--spring), translate .35s var(--spring); }
  .more.open li { animation: pop .45s var(--spring) both; }
  .more.open li:nth-child(2) { animation-delay: .04s; }
  .more.open li:nth-child(3) { animation-delay: .08s; }
  .more.open li:nth-child(n+4) { animation-delay: .12s; }

  @media (hover: hover) {
    .play-bar .home:hover img { rotate: -12deg; scale: 1.12; }
    a.mini:hover .art { translate: 0 -4px; rotate: -1.5deg; }
    .grid > li:nth-child(odd) .card:hover { --rot: -1.2deg; }
    .grid > li:nth-child(even) .card:hover { --rot: 1.2deg; }
    .card:hover { --lift: -6px; box-shadow: 0 14px 0 var(--navy), 0 28px 40px rgb(0 54 150 / .18); }
    .card:hover .art img { scale: 1.06; }
    .card:hover .play-badge { scale: 1.15; rotate: -8deg; }
    .card:hover .btn, .btn:hover { transform: translateY(-3px); box-shadow: 0 9px 0 var(--navy); }
  }

  .card:active { --lift: 5px; --s: .985; box-shadow: 0 3px 0 var(--navy); transition-duration: .08s; }
  .card:active .btn, .btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
}

@keyframes grow { from { transform: scaleX(0); } }
@keyframes bob {
  0%, 100% { translate: 0 0; rotate: -2deg; }
  50% { translate: 0 -12px; rotate: 2deg; }
}
@keyframes boing {
  0% { scale: 1 1; rotate: 0deg; }
  15% { scale: 1.2 .8; }
  35% { scale: .88 1.14; rotate: -14deg; }
  75% { scale: 1.06 .95; rotate: 360deg; }
  100% { scale: 1 1; rotate: 360deg; }
}
@keyframes pop { from { opacity: 0; transform: translateY(28px) scale(.9); } }
@keyframes pan { to { background-position: 72px 72px; } }
@keyframes wiggle {
  20% { rotate: -3deg; }
  40% { rotate: 3deg; }
  60% { rotate: -2deg; }
  80% { rotate: 1deg; }
}
@keyframes bubble {
  0% { opacity: 0; scale: .3; }
  20% { opacity: 1; scale: 1.15; }
  35% { scale: 1; }
  75% { opacity: 1; translate: -50% -6px; }
  100% { opacity: 0; translate: -50% -26px; }
}
@keyframes ring {
  0% { opacity: .7; scale: 1; }
  70%, 100% { opacity: 0; scale: 1.18 1.4; }
}
