:root {
  --bg: #050505;
  --ink: #ffffff;
  --muted: #999999;
  --ink-soft: #595959;
  --ink-dim: #474747;
  --gap: 30px;
  --radius: 24px;
  --nav: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --accent: #f43325;
  --work: 1120px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  background: #e7e7e7;
  color: #111;
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.is-loading { overflow: hidden; }

#loader {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  background: #e7e7e7;
  transition: opacity 0.8s var(--ease);
}

#loader.is-done {
  opacity: 0;
  pointer-events: none;
}

/* Document view transitions are skipped in loader.js so in-site moves stay instant. */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.65s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

html.is-returning #loader { display: none; }

html.is-arriving { overflow: hidden; }

html.is-arriving::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #fff;
  clip-path: circle(150vmax at var(--back-ox, 50%) var(--back-oy, 0px));
  pointer-events: none;
}

html.is-arriving.is-uncovering::before {
  clip-path: circle(0 at var(--back-ox, 50%) var(--back-oy, 0px));
  transition: clip-path 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html.is-arriving #loader { display: none; }

.theme-dark #loader { background: #181818; }

.theme-dark .loader-rule { background: #f2f2f2; }

.loader-rule {
  width: 44px;
  height: 1px;
  background: #111;
  transform-origin: center;
  animation: loader-draw 1.8s var(--ease) infinite;
}

@keyframes loader-draw {
  0%, 100% { transform: scaleX(0.18); opacity: 0.35; }
  45% { transform: scaleX(1); opacity: 1; }
}

body.light {
  background: #fff;
  color: #111;
  color-scheme: light;
}

a { color: inherit; }

#field {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: #e7e7e7;
}

#field > .drift-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site {
  position: relative;
}

::selection {
  background: #111;
  color: #fff;
}

.ink { position: relative; }

.ink-rim {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

html.ink-live .ink-face,
html.ink-live .ink-rim {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: var(--ink);
  background-repeat: no-repeat;
  background-size: 100vw 100vh;
  -webkit-background-clip: text;
  background-clip: text;
}

html.ink-live .ink-face {
  position: relative;
  z-index: 1;
  background-position: center;
  background-attachment: fixed;
  padding-inline: 0.2em;
  margin-inline: -0.2em;
}

html.ink-live .ink-rim {
  visibility: visible;
  z-index: 0;
  background-position: calc(-1 * var(--ink-x, 0px)) calc(-1 * var(--ink-y, 0px));
  filter: invert(1) blur(1.6px);
}

html.ink-live .ink:focus-visible {
  outline-color: #111;
}

.card:focus-visible,
.play:focus-visible,
.card-links a:focus-visible,
.colophon-legal a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26vh 24px 16vh;
}

.hero h1 {
  margin: 0;
  font-family: "DM Sans", Inter, sans-serif;
  font-weight: 600;
  font-size: clamp(88px, 15.6vw, 240px);
  line-height: 0.83;
  letter-spacing: -0.083em;
  color: #111;
}

.lede {
  margin: 56px 0 0;
  max-width: 560px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.45;
  color: #5a5a5a;
}

.work {
  width: min(var(--work), calc(100% - 80px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding-bottom: 28px;
}

.row {
  display: grid;
  gap: var(--gap);
}

.row.short-a,
.row.short-c { grid-template-columns: 430fr 660fr; aspect-ratio: 1120 / 368; }

.row.short-d { grid-template-columns: 660fr 430fr; aspect-ratio: 1120 / 368; }

.row.feature {
  grid-template-columns: 660fr 430fr;
  aspect-ratio: 1120 / 766;
}

.col {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  min-height: 0;
}

.card.card-feature {
  perspective: 1400px;
}

.card {
  --tile: #1c1c1c;
  position: relative;
  display: block;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: var(--tile);
  transition: background-color 0.45s var(--ease);
}

.glyph svg .mark {
  fill: currentColor;
  transition: fill 0.3s var(--ease);
}

/* Posed parts reuse their dots; they used to be rebuilt each frame and so never faded. */
.glyph svg .is-moving .mark { transition: none; }

.card:not(.card-links).is-motion-active .glyph svg .accent .mark,
.card-links a.is-motion-active .glyph svg .accent .mark { fill: var(--accent); }

.glyph svg .eye,
.glyph svg .leg-b { opacity: 0; }

.card.is-motion-active .glyph[data-glyph="invader"] .eye { opacity: 1; }

a.card.is-motion-active { background: #262626; }

.card h2,
.kicker,
.play,
.link-label {
  font-family: "Space Grotesk", Inter, sans-serif;
}

.card h2 {
  position: absolute;
  left: 26px;
  right: 22px;
  bottom: 22px;
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.045em;
  z-index: 2;
}

.card.is-light {
  --tile: #fff;
  color: #161616;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

a.card.is-light.is-motion-active { background: #f4f4f4; }

.kicker {
  position: absolute;
  top: 20px;
  left: 26px;
  z-index: 2;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.5;
}

.glyph {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 20px;
  bottom: 68px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.glyph svg {
  display: block;
  width: min(220px, 74%);
  height: auto;
  max-height: 100%;
  overflow: visible;
  fill: currentColor;
}

.glyph[data-glyph="work"] svg { width: min(232px, 64%); }

.glyph[data-glyph="books"] svg { width: min(212px, 56%); }

.glyph[data-glyph="blog"] svg { width: min(236px, 66%); }

.glyph[data-glyph="projects"] {
  inset: 0;
  align-items: stretch;
  justify-content: stretch;
}

.card-feature h2 { z-index: 2; }

.glyph[data-glyph="projects"] canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  height: 118%;
  max-width: none;
  display: block;
}

.glyph[data-glyph="principles"] svg { width: min(190px, 46%); }

.glyph[data-glyph="invader"] svg { width: min(176px, 42%); }

.glyph[data-glyph="about"] svg { width: min(200px, 56%); }

.card-motto .motto {
  position: absolute;
  left: 26px;
  right: 22px;
  top: 24px;
  bottom: 24px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.28em;
  margin: 0;
  font-family: Doto, "Space Grotesk", sans-serif;
  font-size: clamp(28px, 2.5vw, 40px);
  font-weight: 600;
  font-variation-settings: "ROND" 100;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.card-motto .motto-dot {
  color: var(--accent);
}

.card-links .link-row {
  position: absolute;
  inset: 0 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
}

.card-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  transition: color 0.35s var(--ease);
}

.card-links .glyph {
  position: relative;
  inset: auto;
  width: 80px;
  height: 80px;
  flex: none;
}

.card-links .glyph svg { width: 100%; }

.link-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.card-game { user-select: none; }

.card-game:not(.is-on).is-motion-active { background: #262626; }

.card-game .glyph { top: 22px; bottom: 68px; }

.play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  margin: 0;
  padding: 22px 22px 22px 26px;
  border: 0;
  background: none;
  color: inherit;
  appearance: none;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-align: left;
  cursor: pointer;
}

.card-game .play:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -8px;
}

.card-game canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
}

.card-game.is-on { touch-action: none; cursor: auto; }

.card-game.is-on canvas { display: block; }

.card-game.is-on .glyph,
.card-game.is-on .play { display: none; }

.colophon {
  width: min(var(--work), calc(100% - 80px));
  margin: 42px auto 0;
  padding: 8px 0 72px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  color: #1a1a1a;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.colophon .now { text-align: right; }

.colophon-legal {
  display: flex;
  gap: 28px;
  font-weight: 400;
  letter-spacing: 0;
  font-variant-numeric: normal;
}

.colophon-legal a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.colophon-legal a:hover { opacity: 0.55; }

.colophon-legal a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.colophon-legal a[aria-current="page"]:hover { opacity: 1; }

@media (hover: hover) and (pointer: fine) and (min-width: 901px) {
  .card:not(.card-links):hover .glyph svg .accent .mark,
  .card-links a:hover .glyph svg .accent .mark { fill: var(--accent); }
  .card:hover .glyph[data-glyph="invader"] .eye { opacity: 1; }
  a.card:hover,
  .card-game:not(.is-on):hover { background: #262626; }
  a.card.is-light:hover { background: #f4f4f4; }
}

@media (hover: none), (pointer: coarse) {
  /* Browser toolbar changes must not resize/reallocate the background on scroll. */
  #field { height: 100lvh; bottom: auto; }
}

@media (max-width: 900px) {
  .hero { padding: 22vh 20px 64px; min-height: 0; }
  .lede { font-size: 18px; }
  .work, .colophon { width: calc(100% - 32px); }
  .row.short-a,
  .row.short-c,
  .row.short-d,
  .row.feature {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }
  .card { aspect-ratio: 4 / 3.15; transition: none; }
  .card-links a,
  .glyph svg .mark { transition: none; }
  .row.feature > .card { aspect-ratio: 4 / 4.4; }
  .col { grid-template-rows: none; }
  .card h2 { font-size: 26px; left: 20px; bottom: 16px; }
  .play { font-size: 26px; padding: 16px 18px 16px 20px; }
  .kicker { left: 20px; top: 16px; }
  .card-motto .motto { left: 20px; right: 18px; font-size: 30px; }
  .card-links .glyph { width: 64px; height: 64px; }
  .colophon {
    flex-wrap: nowrap;
    gap: clamp(8px, 2.4vw, 20px);
    font-size: clamp(11px, 3vw, 14px);
    padding-bottom: 48px;
  }
  .colophon > * { white-space: nowrap; }
  .colophon-legal { gap: clamp(10px, 3vw, 24px); }
  .colophon-legal a { padding-block: 12px; }
}

#cursor-head,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  will-change: transform;
}

#cursor-head {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  opacity: 0;
}

#cursor-head.is-on { opacity: 1; }

.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  html.has-cursor,
  html.has-cursor *:not(input):not(textarea):not(select):not([contenteditable="true"]) {
    cursor: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #loader { transition: none; }
  html.is-arriving.is-uncovering::before { transition: none; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none !important; }
  .loader-rule { animation: none; opacity: 1; transform: none; }
  .card { transition: none; }
  .glyph svg g,
  .glyph svg .mark { animation: none !important; transition: none !important; }
  .glyph svg g { transform: none !important; }
}
