/* ==========================================================================
   Lowman LLC
   ========================================================================== */

/* Fragment Mono — SIL Open Font License, see fonts/FragmentMono-OFL.txt */
@font-face {
  font-family: "Fragment Mono";
  src: url("../fonts/FragmentMono-Regular-latin.woff2") format("woff2");
  font-weight: 400;
  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: "Fragment Mono";
  src: url("../fonts/FragmentMono-Regular-latin-ext.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Dot Matrix";
  src: url("../fonts/DotMatrix.woff2") format("woff2"),
       url("../fonts/DotMatrix.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}

:root {
  --bg: #121212;
  --ink: #ececec;
  --dot: #d6d6d6;
  --muted: #6b6b6b;
  --line: rgba(255, 255, 255, 0.1);
  --card: #1d1d1d;
  --art-bg: #000000;
  --accent: #ff611b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4);

  --pad: clamp(16px, 2.8vw, 40px);
  --cols: 10;
  --col: calc((100vw - 2 * var(--pad)) / var(--cols));
  --dot-size: calc(var(--col) * 1.26);
  --row: calc(var(--dot-size) * 1.1);
  --header-h: 56px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

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

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

/* Native smooth anchors only when Lenis isn't running (reduced motion or script blocked). */
html:not(.lenis) { scroll-behavior: smooth; }

/* Lenis 1.3.26 base styles (MIT, see js/vendor/LENIS-LICENSE.txt) */
html.lenis,
html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Fragment Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.3;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; }

h1, h2, h3, p, ol, ul { margin: 0; font-weight: 400; font-size: inherit; }
ol, ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; text-transform: inherit; }
img, canvas { display: block; max-width: 100%; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

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

/* Dot-matrix display type */
.dot {
  font-family: "Dot Matrix", monospace;
  font-size: var(--dot-size);
  line-height: 1;
  /* Glyphs are 0.7em wide; this spacing makes each one advance exactly one grid column. */
  letter-spacing: 0.094em;
  color: var(--dot);
  text-transform: uppercase;
  white-space: pre;
  transition: color 0.4s var(--ease);
}

.dot--hollow {
  color: transparent;
  -webkit-text-stroke: 1px var(--dot);
}

/* ---------- Shared bits ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.02em;
}

.logo i {
  width: 6px;
  height: 6px;
  margin: 0 1px 3px;
  border-radius: 50%;
  background: currentColor;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.4s var(--ease);
}

.pill i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.pill:hover { transform: translateY(-1px); }

.pill--dark { background: var(--ink); color: var(--bg); }

.pill--accent { color: var(--accent); }

.pill--muted { color: var(--muted); cursor: default; }
.pill--muted:hover { transform: none; }

.soon { color: var(--accent); }

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: background-color 0.3s var(--ease);
}

.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s var(--ease);
}

.switch.is-on { background: var(--accent); }
.switch.is-on i { transform: translateX(18px); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 28px;
}

.blink-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.4s steps(2, jump-none) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Loader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: 27vh auto auto 1fr;
  padding: 0 var(--pad);
  background: var(--bg);
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}

.loader.is-done { opacity: 0; visibility: hidden; }

.loader__label {
  grid-column: 1 / span 3;
  grid-row: 2;
  color: var(--accent);
}

.loader__arrow {
  grid-column: 1;
  grid-row: 3;
  margin-top: 12vh;
}

.loader__count {
  grid-column: 6 / -1;
  grid-row: 2 / span 2;
  justify-self: end;
}

.loader__logo { display: flex; margin-top: 18px; }

/* ---------- Header ---------- */

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
  padding: 0 var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background-color 0.4s var(--ease);
}

.header .logo { margin-right: auto; }

.header__nav { display: flex; gap: 24px; }

.header__nav a,
.footer__social a { position: relative; }

.header__nav a::after,
.footer__social a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}

.header__nav a:hover::after,
.footer__social a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  /* Row 2 grows if the intro paragraph wraps taller than a letter row (narrow desktops, tablets). */
  grid-template-rows: var(--row) minmax(var(--row), auto) repeat(2, var(--row));
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--header-h) var(--pad) 40px;
  align-content: start;
}

.hero__grid { display: contents; }

.hero .cell {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hero .cell:hover { color: var(--accent); }

.hero__intro {
  grid-column: 4 / span 2;
  grid-row: 2;
  padding-right: 12px;
  max-width: 300px;
}

.hero__hint {
  grid-column: 7 / span 2;
  grid-row: 3;
  color: var(--muted);
  margin-top: 4px;
}

.hero__scroll {
  grid-column: 3 / span 2;
  grid-row: 4;
  align-self: end;
}

.hero__status {
  grid-column: 8 / span 3;
  grid-row: 4;
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  text-align: right;
}

.hero__status:hover { color: var(--accent); }

/* ---------- Latest releases ---------- */

.releases { padding: 120px var(--pad) 0; scroll-margin-top: calc(var(--header-h) - 120px); }

.releases__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.release__media {
  position: relative;
  display: block;
  aspect-ratio: 1.34;
  overflow: hidden;
  border-radius: 4px;
  background: var(--art-bg);
}

.release__media canvas,
.release__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}

.release:hover .release__media canvas,
.release:hover .release__media img { transform: scale(1.04); }

.release__logo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: "Dot Matrix", monospace;
  font-size: clamp(28px, 4.4vw, 68px);
  letter-spacing: 0.08em;
  text-align: center;
  background: radial-gradient(ellipse 62% 30% at center, rgba(0, 0, 0, 0.78), transparent 75%);
  pointer-events: none;
}

.release__meta {
  display: grid;
  grid-template-columns: var(--col) 1fr auto;
  align-items: center;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.release__actions { display: flex; gap: 8px; }

/* ---------- Statement ---------- */

.statement {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  padding: 200px var(--pad) 220px;
  align-items: start;
}

.statement__arrow {
  grid-column: 1;
  margin-top: calc(var(--dot-size) * 0.15);
}

.statement__word { grid-column: 3 / span 4; }

.statement__copy {
  grid-column: 8 / -1;
  display: grid;
  gap: 1.2em;
}

/* ---------- All games ---------- */

.games { padding: 0 var(--pad) 200px; scroll-margin-top: var(--header-h); }

.view-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.game {
  --mini: calc(var(--col) * 0.5);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  align-items: center;
  min-height: 100px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.game:last-child { border-bottom: 1px solid var(--line); }

.game__initial {
  grid-column: 1;
  font-size: var(--mini);
}

.game__year { grid-column: 2; align-self: start; padding-top: 6px; }

.game__specs {
  grid-column: 3 / span 4;
  display: grid;
  gap: 10px;
  padding: 6px 0;
}

.game__specs > div,
.game__year { display: flex; gap: 6px; }

.label { color: var(--muted); }

.game__go {
  grid-column: 7 / span 1;
  justify-self: end;
  margin-right: 24px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-size: 11px;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}

.game__thumb {
  grid-column: 8 / span 2;
  position: relative;
  height: calc(var(--col) * 0.48);
  margin-right: 24px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--art-bg);
}

.game__thumb canvas,
.game__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.4s var(--ease);
}

.game__thumb span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.game__num {
  grid-column: 10;
  justify-self: end;
  font-size: calc(var(--col) * 0.48);
  letter-spacing: 0.08em;
}

.game__link { position: absolute; inset: 0; z-index: 1; }

.game:hover .game__go { background: var(--accent); color: #fff; transform: translateX(3px); }
.game:hover .game__thumb canvas,
.game:hover .game__thumb img { opacity: 1; }
.game:hover .game__num { -webkit-text-stroke-color: var(--accent); }
.game:hover .game__initial { color: var(--accent); }

/* Grid view */
.games__list.is-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 22px;
}

.games__list.is-grid .game {
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 14px 16px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.games__list.is-grid .game__thumb {
  grid-column: 1 / -1;
  grid-row: 1;
  height: auto;
  aspect-ratio: 1.34;
  margin: 0;
}

.games__list.is-grid .game__thumb canvas,
.games__list.is-grid .game__thumb img { opacity: 1; }

.games__list.is-grid .game__thumb span {
  font-family: "Dot Matrix", monospace;
  font-size: clamp(22px, 2.6vw, 40px);
  background: radial-gradient(ellipse 62% 30% at center, rgba(0, 0, 0, 0.78), transparent 75%);
}

.games__list.is-grid .game__initial { grid-column: 1; grid-row: 2; font-size: 40px; }
.games__list.is-grid .game__year { display: none; }
.games__list.is-grid .game__specs { grid-column: 2; grid-row: 2; padding: 0; gap: 6px; }
.games__list.is-grid .game__go { display: none; }
.games__list.is-grid .game__num { grid-column: 3; grid-row: 2; font-size: 28px; }

/* ---------- Studio ---------- */

.studio { padding: 0 var(--pad) 200px; scroll-margin-top: var(--header-h); }

.studio__bits {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: var(--row);
  margin-bottom: 24px;
}

.studio__panel {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--art-bg);
}

.studio__art {
  width: 100%;
  aspect-ratio: 16 / 10;
  image-rendering: pixelated;
}

.studio__card,
.studio__stack {
  position: absolute;
  padding: 20px;
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.studio__card {
  left: 24px;
  bottom: 24px;
  display: grid;
  gap: 20px;
  justify-items: start;
  max-width: 380px;
}

.studio__stack { top: 24px; right: 24px; min-width: 260px; }

.studio__stack h3 { color: var(--muted); margin-bottom: 14px; }

.studio__stack ul {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 28px;
}

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

.footer {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 24px;
  min-height: 100vh;
  padding: 120px var(--pad) 28px;
}

.footer__label { color: var(--muted); }

.footer__clock {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

.footer__digital { font-size: clamp(28px, 4.4vw, 64px); }

.footer__digital:last-child { justify-self: end; }

.clock {
  --size: clamp(250px, 34vw, 500px);
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--bg);
  box-shadow:
    0 0 0 calc(var(--size) * 0.035) color-mix(in srgb, var(--card) 70%, var(--bg)),
    0 calc(var(--size) * 0.05) calc(var(--size) * 0.14) rgba(0, 0, 0, 0.1),
    inset 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: background-color 0.4s var(--ease);
}

.clock__face { position: absolute; inset: 0; }

.clock__tick {
  position: absolute;
  left: 50%;
  top: 3.5%;
  width: 1px;
  height: 2.2%;
  margin-left: -0.5px;
  background: var(--muted);
  transform-origin: 50% calc(var(--size) * 0.465);
}

.clock__tick.is-hour { height: 3.6%; background: var(--ink); }

.clock__num {
  position: absolute;
  width: 2em;
  margin: -0.6em 0 0 -1em;
  text-align: center;
}

.clock__note {
  position: absolute;
  top: 60%;
  width: 100%;
  color: var(--muted);
  text-align: center;
}

.clock__hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  border-radius: 4px;
  transform-origin: 50% 100%;
  background: var(--ink);
}

.clock__hand--h { width: 6px; height: 26%; margin-left: -3px; }
.clock__hand--m { width: 3px; height: 38%; margin-left: -1.5px; }

.clock__hand--s {
  width: 1.5px;
  height: 52%;
  margin-left: -0.75px;
  margin-bottom: -10%;
  background: var(--accent);
  transform-origin: 50% 80.8%;
}

.clock__pin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.footer__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

.footer__social { display: flex; gap: 24px; justify-self: end; }

/* ---------- Responsive ---------- */

/* Portrait tablets: the 10-column hero is much shorter than the screen, so let it end with its content. */
@media (min-width: 761px) and (orientation: portrait) {
  .hero { min-height: 0; padding-bottom: 24px; }
}

@media (max-width: 1100px) {
  /* Store buttons drop under the title so long names don't wrap. */
  .release__meta { grid-template-columns: var(--col) 1fr; row-gap: 12px; }
  .release__actions { grid-column: 2; }
}

@media (max-width: 1024px) {
  .studio__card { max-width: 320px; }
  .games__list.is-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root {
    --cols: 5;
    --dot-size: calc(var(--col) * 1.2);
    --header-h: 52px;
  }

  .header__nav { gap: 16px; }
  .header > .pill { display: none; }

  /* The last row takes the leftover height so the labels sit at the bottom of the screen. */
  .hero { grid-template-rows: repeat(2, var(--row)) auto repeat(3, var(--row)) 1fr; }
  .hero__intro { grid-column: 1 / span 4; grid-row: 3; max-width: none; padding: 14px 0 18px; }
  .hero__hint { display: none; }
  .hero__scroll { grid-column: 1 / span 2; grid-row: 7; padding-top: 24px; align-self: end; }
  .hero__status { grid-column: 3 / span 3; grid-row: 7; padding-top: 24px; justify-content: flex-end; align-self: end; }

  .loader__count { grid-column: 1 / -1; grid-row: 4; align-self: center; justify-self: start; }
  .loader__arrow { margin-top: 6vh; }

  .releases { padding-top: 80px; }
  .releases__grid { grid-template-columns: 1fr; gap: 40px; }

  .statement { padding: 140px var(--pad); row-gap: 40px; }
  .statement__arrow { grid-column: 1; }
  .statement__word { grid-column: 2 / -1; }
  .statement__copy { grid-column: 1 / -1; }

  .game { --mini: calc(var(--col) * 0.6); min-height: 92px; }
  .game__initial { grid-column: 1; }
  .game__year { display: none; }
  .game__specs { grid-column: 2 / span 3; }
  .game__go, .game__thumb { display: none; }
  .game__num { grid-column: 5; font-size: calc(var(--col) * 0.5); }

  .games__list.is-grid { grid-template-columns: 1fr; }
  .games__list.is-grid .game__thumb { display: block; }

  .studio__panel { overflow: visible; background: none; }
  .studio__art { aspect-ratio: 4 / 5; border-radius: 6px; background: var(--art-bg); }
  .studio__card,
  .studio__stack { position: static; margin-top: 12px; max-width: none; }

  .footer { gap: 40px; padding-top: 80px; }
  .footer__clock { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .footer__clock .clock { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .footer__digital { grid-row: 2; }
  .footer__bar { grid-template-columns: 1fr; justify-items: center; gap: 18px; text-align: center; }
  .footer__social { justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
