/* innervate.games: the studio home (logo in the middle, a three-row index bottom left)
   and one page per game (header art, the mark over its edge, spaced title, short text, links, screenshots).
   The site is dark in every colour scheme. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/hanken-grotesk-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #08080c;       /* the logo files' own ground */
  --text: #e2e0e8;      /* links */
  --soft: #b8b5c2;      /* body copy */
  --label: #8a8696;     /* index headings */
  --rule: rgba(255, 255, 255, .13);
  --white: #fff;
  --violet: #a07ce8;    /* logo violet, for focus rings */
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(24px, 4.2vw, 60px);
  background: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 18px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
::selection { background: var(--text); color: var(--ink); }
a { color: inherit; }
img, video { display: block; max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, p, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 4px; }

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

/* ---------- Home ---------- */

.home {
  /* the logo box is 880 x 740 of the 1920 x 1080 logo frame; smaller on short screens so it never meets the index */
  --logo-w: min(340px, 72vw, calc((100svh - 250px) * .62 * 880 / 740));
  min-height: max(100svh, 540px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  /* on tall screens the top padding matches the index, so the logo sits on the true middle */
  padding: clamp(0px, calc(100svh - 700px), 190px) var(--pad) 0;
}

.identity {
  place-self: center;
  position: relative;
  width: var(--logo-w);
  aspect-ratio: 880 / 740;
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}
/* The clip is the full 1920 x 1080 frame, cropped to the logo by the box. The still logo is that box
   cut from logo.png and saved as plain sRGB: logo.png's colour tags make browsers draw its ground darker than the page. */
.identity video {
  position: absolute;
  max-width: none;
  width: 218.182%;          /* 1920 / 880 */
  height: auto;
  aspect-ratio: 16 / 9;
  left: -59.091%;           /* 520 / 880 */
  top: -22.162%;            /* 164 / 740 */
  mix-blend-mode: lighten;  /* the clip opens on pure black; this keeps it on the page's ink */
}
.identity img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; max-width: none; }
.identity.is-playing img { opacity: 0; }
.identity.is-fading img { transition: opacity .35s ease; }

.index {
  justify-self: start;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 14px 0;
  padding-bottom: 30px;
  margin-left: -12px;
  transition: opacity 1.4s cubic-bezier(.5, 0, 0, 1);
}
.home.is-intro .index { opacity: 0; transition: none; }
.index h2 {
  min-width: 9rem;
  padding-right: 18px;
  text-align: right;
  color: var(--label);
  font: 700 13px/1 var(--sans);
  letter-spacing: .5em;
  text-transform: uppercase;
}
.index ul { display: flex; flex-wrap: wrap; align-items: baseline; }
.index li { display: flex; align-items: baseline; font-size: 19px; line-height: 40px; white-space: nowrap; }
.index li + li::before {
  content: "";
  display: inline-block;
  width: 0; height: 1em;
  margin: 0 .6em;
  border-left: 1px solid var(--rule);
  align-self: center;
}
.index a, .links a {
  text-decoration: underline 1px transparent;
  text-underline-offset: .28em;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.index a:hover { color: var(--white); text-decoration-color: rgba(255, 255, 255, .6); }

/* ---------- Game page ---------- */

.hero {
  height: 50svh;
  min-height: 240px;
  overflow: hidden;
  background: #000;
}
.hero img {
  width: 100%; height: 100%; max-width: none;
  object-fit: cover;
  object-position: 50% 56%;
}

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--pad) 96px;
}

.mark {
  display: block;
  width: 78px;
  margin-top: -55px;        /* about half the mark sits over the art */
  position: relative;
  z-index: 2;
  transition: opacity .3s ease;
}
.mark:hover { opacity: .8; }
.mark img { width: 100%; height: auto; }

.title {
  margin: 64px 0;
  color: var(--text);
  font: 700 clamp(24px, 3.05vw, 44px)/1.15 var(--sans);
  letter-spacing: .52em;
  text-transform: uppercase;
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 1fr) minmax(0, 3fr);
}
.about { grid-column: 1; max-width: 35em; color: var(--soft); }
.about p { font-size: 19px; line-height: 36px; }
.about p + p { margin-top: 18px; }
.about em { color: var(--text); }

.links { grid-column: 3; font-size: 20px; line-height: 40px; margin-top: -2px; }
.links a { color: var(--white); }
.links a:hover { text-decoration-color: rgba(255, 255, 255, .6); }
.links a::after { content: "\2192"; display: inline-block; padding-left: .5em; opacity: .7; transition: transform .2s ease; }
.links a:hover::after { transform: translateX(3px); }

.media {
  margin-top: 80px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.media li { aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.media li:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.media a { display: block; width: 100%; height: 100%; }
.media img { width: 100%; height: 100%; max-width: none; object-fit: cover; transition: opacity .4s cubic-bezier(.5, 0, 0, 1); }
.media a:hover img { opacity: .75; }
.media a:focus-visible { outline-offset: -4px; }

/* Arriving on a game page: the art eases in, then the title, the text and the links. */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes settle { from { opacity: 0; transform: scale(1.04); } }
@keyframes fade { from { opacity: 0; } }
.game .hero img { animation: settle 1.6s cubic-bezier(0, .25, 0, 1) both; }
.game .mark { animation: fade 1s ease .25s both; }
.game .title { animation: rise 1.4s cubic-bezier(0, .5, 0, 1) .2s both; }
.game .about { animation: rise 1.4s cubic-bezier(0, .5, 0, 1) .3s both; }
.game .links { animation: rise 1.4s cubic-bezier(0, .5, 0, 1) .4s both; }
.game .media { animation: fade 1.2s ease .5s both; }

/* Screenshot viewer */
.viewer {
  border: 0; padding: 0; margin: auto;
  background: transparent;
  max-width: 94vw; max-height: 92svh;
  overflow: visible;
}
.viewer::backdrop { background: rgba(4, 4, 7, .92); }
.viewer img { max-width: 94vw; max-height: 88svh; width: auto; height: auto; }
.viewer button {
  position: fixed; top: 12px; right: 12px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: 400 30px/1 var(--sans);
  cursor: pointer;
}
.viewer button:hover { color: var(--white); }

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  .index { grid-template-columns: 1fr; gap: 0; margin-left: 0; padding-bottom: 26px; }
  .index h2 { min-width: 0; padding: 14px 0 2px; text-align: left; font-size: 12px; }
  .index h2:first-child { padding-top: 0; }
  .index ul { column-gap: 22px; }
  .index li { font-size: 18px; line-height: 36px; }
  .index li + li::before { display: none; }   /* a wrapped row would start with a divider */

  .hero { height: 42svh; }
  .mark { width: 60px; margin-top: -42px; }
  .title { margin: 40px 0 32px; letter-spacing: .4em; }
  .cols { grid-template-columns: 1fr; }
  .about p { font-size: 17px; line-height: 30px; }
  .links { grid-column: 1; margin-top: 28px; font-size: 18px; line-height: 40px; }
  .media { margin-top: 48px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .media li:first-child { grid-row: auto; aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .identity video { display: none; }
}
