/* MÖKKIGAMES website. Black and white, with the Gridmere game art as the only colour. */

@font-face {
  font-family: "Lilita One";
  src: url("../assets/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Rubik";
  src: url("../assets/fonts/Rubik-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rubik";
  src: url("../assets/fonts/Rubik-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #000;
  --fg: #fff;
  --muted: #b5b5b5;          /* 10.2:1 on black */
  --tick: #5c5c5c;           /* 3.1:1 on black, for the unfilled gallery ticks */
  --line: #2b2b2b;
  --yellow: #ffe27b;         /* the gridmere.com yellow from the shorts' end card */

  /* one spacing scale, used everywhere */
  --s1: 6px;
  --s2: 12px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --s6: 44px;
  --s7: 64px;
  --s8: 88px;

  --gutter: clamp(16px, 3.2vw, 34px);
  --section: clamp(64px, 8.4vw, 112px);
  --maxw: 960px;
  --header: 56px;
  --radius: 14px;
  --heads-room: 19svh;       /* the bottom band the peeking heads live in */

  --display: "Lilita One", "Arial Rounded MT Bold", "Arial Black", sans-serif;
  --body: "Rubik", "Segoe UI", system-ui, sans-serif;
}

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

html {
  background: var(--bg);
  color: var(--fg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + var(--s2));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd, ol { margin: 0; padding: 0; }
ol { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: var(--s1);
  left: var(--s1);
  z-index: 100;
  padding: var(--s1) var(--s2);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--display);
  text-decoration: none;
  border-radius: 8px;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 4px;
  border-radius: 6px;
}

.display {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 6.3vw, 90px);
  line-height: 0.95;
  letter-spacing: 0.005em;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: var(--s1);
  text-decoration: none;
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}
.brand img { flex: none; width: 22px; height: auto; }

/* the header brand waits above the bar until the big logo has scrolled away */
.site-header .brand {
  transform: translateY(calc(-1 * var(--header)));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.site-header.scrolled .brand,
.site-header .brand:focus-visible,
html:not(.js) .site-header .brand { transform: none; }

.nav { display: flex; gap: var(--s4); }
.nav a {
  position: relative;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  padding: var(--s1) 0;
}
.nav a::after,
.big-link::after,
.foot-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav a:hover::after,
.big-link:hover::after,
.foot-links a:hover::after { transform: scaleX(1); }

/* ------------------------------------------------------------------ buttons */

.btn {
  --edge: #8a8a8a;
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 44px;
  padding: 0 var(--s4);
  border-radius: 12px;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--edge);
  transform: translateY(0);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn svg { width: 18px; height: auto; fill: currentColor; flex: none; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--edge); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); transition-duration: 0.05s; }

.btn-white { background: var(--fg); color: var(--bg); }
.btn-black { --edge: var(--fg); background: var(--bg); color: var(--fg); border: 2px solid var(--fg); }

/* ------------------------------------------------------------------ the Gridmere logo (pops in like the shorts' end card) */

.logo {
  position: relative;
  display: block;
  padding: 0;
  margin: 0 auto;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.logo.static { cursor: default; }
.logo-box {
  position: relative;
  display: block;
  width: 100%;
}
.logo .piece {
  position: absolute;
  max-width: none;
  transform-origin: 50% 100%;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.js .logo .piece { visibility: hidden; }
.js .logo.ready .piece,
.js .logo.settled .piece { visibility: visible; }

.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.stars img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  visibility: hidden;
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 360px;
  overflow: hidden;
  background: var(--bg);
}
.hero-stage {
  position: absolute;
  inset: var(--header) 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  padding: 0 var(--gutter) var(--heads-room);
}
.hero-logo {
  /* 1600 x 883; the middle value keeps it clear of the heads on short screens */
  width: clamp(min(46vw, 200px), calc((74svh - 180px) * 1.27), min(60vw, 700px));
}
.hero-logo img { width: 100%; height: auto; }
.hero-line {
  font-family: var(--display);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.2;
  text-align: center;
}

/* ------------------------------------------------------------------ the peeking heads */

.heads {
  position: absolute;
  inset: auto 0 0 0;
  height: 0;
  z-index: 4;
  pointer-events: none;
}
html:not(.js) .heads { display: none; }
.head {
  position: absolute;
  left: calc(var(--x) * 100%);
  bottom: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.head .sprite {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(var(--w) * var(--tx));
  height: calc(var(--h) * var(--tx));
  pointer-events: none;
  will-change: transform;
}
.head .sprite img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}
/* only the middle of the sprite (the face and hair) takes clicks, so overlapping heads poke the right one */
.head .hit {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20%;
  width: 60%;
  pointer-events: auto;
}
.head .sprite img.alt { visibility: hidden; }
.head.wow .sprite img.alt { visibility: visible; }
.head.wow .sprite img.main { visibility: hidden; }
.head:focus-visible { outline: none; }
.head:focus-visible .sprite { outline: 3px solid var(--fg); outline-offset: 4px; border-radius: 6px; }

/* ------------------------------------------------------------------ Gridmere intro */

.gm-intro {
  padding: var(--section) 0 var(--s7);
  text-align: center;
}
.logo-gridmere {
  width: min(100%, 616px);
}
.logo-gridmere .logo-box { aspect-ratio: 972 / 272; }
.shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask: url("../assets/gridmere/logo.png") center / 100% 100% no-repeat;
  mask: url("../assets/gridmere/logo.png") center / 100% 100% no-repeat;
  pointer-events: none;
}
.shine span {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 9%;
  background: var(--fg);
  opacity: 0.7;
  box-shadow: 24px 0 0 -4px var(--fg);
  transform: translateX(-200%) skewX(-24deg);
  visibility: hidden;
}
.gm-lead {
  max-width: 520px;
  margin: var(--s5) auto 0;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.5;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2) var(--s3);
  margin-top: var(--s5);
}
.platforms {
  margin-top: var(--s4);
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ Gridmere gallery */

/* Without JavaScript, or on a screen too short to pin it, this is a plain list of pictures. */
.slides {
  display: grid;
  gap: var(--s6);
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) var(--section);
}
.slide img { width: 100%; height: auto; border-radius: var(--radius); image-rendering: pixelated; }
.slide h3 { margin-top: var(--s3); font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3vw, 42px); line-height: 1; }
.slide p { margin-top: var(--s1); color: var(--muted); }
.gallery-stage { display: none; }

/* With JavaScript the section pins and scrolling places each next picture on the grid. */
.gallery.pinned { height: var(--gallery-h, 500vh); }
.gallery.pinned .gallery-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  padding: calc(var(--header) + var(--s2)) var(--gutter) var(--s4);
}
.screen {
  position: relative;
  width: var(--screen-w, 100%);
  height: var(--screen-h, 56vw);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b0b0b;
  flex: none;
}
.screen canvas { display: block; width: 100%; height: 100%; }
.caption {
  width: var(--screen-w, 100%);
  min-height: var(--caption-h, 0px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  flex: none;
}
/* next to a narrow screen the ticks go under the text */
.gallery-stage.stack .caption { flex-direction: column; justify-content: flex-start; gap: var(--s2); }
.gallery-stage.stack .caption-desc { font-size: 15px; }
.gallery-stage.stack .ticks li { width: 12px; height: 12px; border-radius: 3px; }
.caption-text { min-width: 0; }
.count {
  font-family: var(--display);
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
}
.caption h3 {
  margin-top: var(--s1);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, min(2.8vw, 4.5svh), 42px);
  line-height: 1;
  transform-origin: 0 100%;
}
.caption-desc {
  margin-top: var(--s1);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}
.ticks {
  display: flex;
  gap: var(--s1);
  flex: none;
  padding-top: var(--s1);
}
.ticks li {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--tick);
  transform: scale(0.72);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s linear;
}
.ticks li.on { background: var(--fg); transform: scale(1); }

/* ------------------------------------------------------------------ end card */

.endcard {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 360px;
  overflow: hidden;
}
.endcard-stage {
  position: absolute;
  inset: var(--header) 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  padding: 0 var(--gutter) var(--heads-room);
  text-align: center;
}
.endcard-line {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(20px, 2.5vw, 31px);
  line-height: 1.1;
}
.endcard-url {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(44px, 7.7vw, 118px);
  line-height: 0.95;
  color: var(--yellow);
  text-decoration: none;
  transform-origin: 50% 100%;
}

/* ------------------------------------------------------------------ contact */

.contact {
  padding: var(--section) 0;
  border-top: 1px solid var(--line);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s6);
  align-items: start;
}
.contact-intro {
  max-width: 320px;
  margin-top: var(--s3);
  color: var(--muted);
}
.contact-list .row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.contact-list .row:first-child { border-top: 1px solid var(--line); }
.contact-list dt {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-list dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2);
  min-width: 0;
}
.big-link,
.big-text {
  position: relative;
  font-family: var(--display);
  font-size: clamp(20px, 2.1vw, 27px);
  line-height: 1.15;
  text-decoration: none;
  overflow-wrap: break-word;
  min-width: 0;
}
.copy {
  min-height: 36px;
  padding: 0 var(--s2);
  border: 2px solid var(--fg);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--display);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.copy:hover { transform: translateY(-2px); }
.copy:active { transform: translateY(2px); }
.copy.done { background: var(--fg); color: var(--bg); }

/* ------------------------------------------------------------------ footer */

.site-footer {
  padding: var(--s5) 0;
  border-top: 1px solid var(--line);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) var(--s5);
}
.brand-foot { font-size: 16px; }
.brand-foot img { width: 20px; }
.legal { color: var(--muted); font-size: 13px; }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--s3); margin-left: auto; }
.foot-links a {
  position: relative;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding-bottom: 2px;
}
.foot-links a:hover { color: var(--fg); }
.foot-links a::after { height: 1px; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
}

@media (max-width: 800px) {
  :root { --header: 52px; }
  .nav { gap: var(--s4); }
  .contact-list .row { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .copy { min-height: 44px; }
  .foot-links { margin-left: 0; }
}

@media (max-width: 420px) {
  .actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 339px) {
  .site-header .brand span { display: none; }
}

@media (max-height: 520px) {
  :root { --heads-room: 16svh; }
  .hero-stage, .endcard-stage { gap: var(--s2); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .copy, .nav a::after, .big-link::after, .foot-links a::after, .ticks li, .site-header .brand { transition: none; }
}
