/* xmolegames. An old printed sheet: the logo large at the top and a black band at
   the foot. Black ink on old paper, the logo's own colours; Montserrat, the logo's
   own type. */

@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --paper: #f2eee9;
  --ink: #111111;
  --ink-soft: #4b4945;
  --on-night: #f2eee9;
  --on-night-soft: #a8a49d;

  --face: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --max: 1080px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* Old paper: faint mottling and specks over the ground colour. */
body {
  margin: 0;
  background: var(--paper) url("/media/paper.webp") 0 0 / 640px;
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--face);
}

/* The page is shorter than a tall window: let the black band grow so it always
   reaches the bottom, with no paper showing under the footer. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; display: flex; flex-direction: column; }
#contact { flex: 1 0 auto; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 64px);
  margin-inline: auto;
  padding-left: max(16px, 4vw, env(safe-area-inset-left, 0px));
  padding-right: max(16px, 4vw, env(safe-area-inset-right, 0px));
}
@media (min-width: 1200px) { .wrap { padding-left: 32px; padding-right: 32px; } }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  padding: 8px 14px; background: var(--ink); color: var(--paper); text-decoration: none;
}
.skip:focus { top: 12px; }

/* Wear like the logo's, cut out of live type. --wear sets the scale of the wear
   pattern: smaller means coarser, more broken. Body text stays clean. */
.worn {
  -webkit-mask-image: url("/media/wear.webp");
  mask-image: url("/media/wear.webp");
  -webkit-mask-size: var(--wear, 740px) auto;
  mask-size: var(--wear, 740px) auto;
}

/* Printed rules: a line with ragged edges and the odd break. */
.rule {
  -webkit-mask: url("/media/rule.webp") 0 0 / 1600px 100% repeat-x;
  mask: url("/media/rule.webp") 0 0 / 1600px 100% repeat-x;
}
.rule {
  height: 4px; margin: 0; border: 0;
  background: var(--ink); opacity: 0.45;
}

/* Hero: the logo, large. */

.hero {
  display: grid; justify-items: center; gap: clamp(16px, 3vw, 28px);
  padding-top: max(clamp(48px, 9vw, 104px), env(safe-area-inset-top, 0px));
  padding-bottom: clamp(48px, 9vw, 104px);
  text-align: center;
  overflow-x: clip;  /* the X's wobble room reaches past the logo; never past the screen */
  position: relative;
}

/* The logo is layers. The letters, in paper colour, blend by difference over the
   page: black on paper, paper on the black X. The X sits in .ground, which clips it
   at the logo's bottom edge: that edge is the ground it digs up through. Each letter
   is its own image (placed by logo.css) so site.js can knock it about. */
.logo { position: relative; margin: 0; width: min(640px, 100%); aspect-ratio: 1280 / 988; }
.x { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.letters { position: absolute; inset: 0; pointer-events: none; }
.l { position: absolute; height: auto; mix-blend-mode: difference; transform-origin: 50% 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* The ground box reaches past the logo at the top and sides so the X can wobble
   without being cut; only its bottom edge is the logo's. */
.ground { position: absolute; left: -10%; right: -10%; top: -15%; bottom: 0; overflow: hidden; }
.dig {
  position: absolute; left: 8.333%; width: 83.333%; top: 13.043%; height: 86.957%;
  transform-origin: 50% 100%;
}

/* The mound of earth that swells before the X breaks through. */
.mound {
  position: absolute; left: 50%; bottom: 0; width: 22%; height: 7%;
  background: var(--ink);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: translateX(-50%) scaleY(0); transform-origin: 50% 100%;
  -webkit-mask: url("/media/wear.webp") 0 0 / 300px auto;
  mask: url("/media/wear.webp") 0 0 / 300px auto;
}

/* Dirt thrown up by the X; site.js adds and removes the crumbs. */
.dirt { position: absolute; inset: 0; pointer-events: none; }
.dirt i { position: absolute; background: var(--ink); border-radius: 42% 58% 55% 45%; }

/* While the intro plays (site.js sets .intro on <html>): the X starts underground
   and the tagline waits. Without the script none of this applies. */
.intro .dig { transform: translateY(105%); }
.intro .tagline { opacity: 0; }

.tagline {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 500; letter-spacing: 0.02em;
}

/* A rubber stamp pressed on the sheet: thick border, a thin one inside, worn ink.
   Under the tagline on small screens; beside the logo where there is room. */
.badge {
  --wear: 260px;
  position: relative;
  margin: 6px 0 0; padding: 11px 18px 9px;
  border: 3px solid var(--ink); border-radius: 6px;
  font-size: 0.85rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
  rotate: -6deg;
  -webkit-mask-image: url("/media/wear.webp");
  mask-image: url("/media/wear.webp");
  -webkit-mask-size: var(--wear) auto;
  mask-size: var(--wear) auto;
}
.badge::before {
  content: ""; position: absolute; inset: 3px;
  border: 1.5px solid var(--ink); border-radius: 3px;
}
@media (min-width: 1140px) {
  .badge {
    position: absolute; margin: 0;
    left: calc(50% + 320px + 8px);  /* past the right edge of the 640 px logo */
    top: calc(clamp(48px, 9vw, 104px) + 150px);
    font-size: 0.95rem;
    rotate: 8deg;
  }
}
.intro .badge { opacity: 0; }

.contact h2 {
  margin: 0 0 18px;
  font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.02em;
}

/* Contact and footer: the black band. */

/* Old black print, with specks, and a worn top edge where it meets the paper. */
.night { position: relative; background: var(--ink) url("/media/night.webp") 0 0 / 640px; color: var(--on-night); }
#contact::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: calc(100% - 1px); height: 48px;
  background: inherit;
  -webkit-mask: url("/media/edge.webp") 0 100% / 1600px 48px repeat-x;
  mask: url("/media/edge.webp") 0 100% / 1600px 48px repeat-x;
  pointer-events: none;
}
.contact { padding-top: clamp(56px, 9vw, 104px); padding-bottom: clamp(40px, 6vw, 64px); }
.contact p { margin: 0 0 8px; color: var(--on-night-soft); }
.mail {
  display: inline-block; margin-top: 14px;
  font-size: clamp(1.4rem, 4.4vw, 2.6rem); font-weight: 700; letter-spacing: -0.01em;
  color: var(--on-night); text-decoration: none; overflow-wrap: anywhere;
  border-bottom: 3px solid color-mix(in srgb, var(--on-night) 35%, transparent);
  transition: border-color 0.2s;
}
.mail:hover { border-color: var(--on-night); }

/* The studio elsewhere: small labelled icons under the email. */
.socials { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 34px 0 0; padding: 0; list-style: none; }
.socials a {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--on-night); text-decoration: none;
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0.8; transition: opacity 0.2s;
}
.socials a:hover { opacity: 1; }
.socials svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding-top: 32px; padding-bottom: max(36px, env(safe-area-inset-bottom, 0px));
}
.foot .rule { flex-basis: 100%; background: var(--on-night); opacity: 0.18; margin-bottom: 8px; }
.foot img { width: 96px; }
.foot p { margin: 0; font-size: 0.85rem; color: var(--on-night-soft); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mail { transition: none; }
}

/* 404 */

.lost {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  text-align: center; padding-block: 48px;
}
.lost img { width: min(280px, 70vw); }
.lost h1 { margin: 8px 0 0; font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.lost p { margin: 0; color: var(--ink-soft); }
.lost a { font-weight: 700; }
