/* kolbyyyy — interface over the organism */

@font-face {
  font-family: 'Anybody';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
  src: url('/fonts/anybody-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Azeret Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/azeret-mono-var.woff2') format('woff2');
}

:root {
  --ink: #fff;
  --mono: 'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display: 'Anybody', 'Arial Black', Impact, sans-serif;
  --hud: 11px;
  --pad: clamp(14px, 2.2vw, 28px);
  --mark: clamp(84px, 16vw, 300px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #000;
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--hud);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}
html.has-cursor, html.has-cursor * { cursor: none !important; }

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.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;
}

/* ---------------------------------------------------------------- wordmark */
.mark {
  position: fixed;
  left: -0.02em;
  bottom: 0.04em;
  margin: 0;
  font-family: var(--display);
  font-size: var(--mark);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--ink);
  mix-blend-mode: difference;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 2;
  font-variation-settings: 'wdth' 100, 'wght' 850;
}
.mark span {
  display: inline-block;
  opacity: 0;
  transform: translateY(45%) skewX(-6deg);
  font-variation-settings: 'wdth' var(--wmin, 70), 'wght' 850;
  animation:
    rise 1.1s var(--ease) var(--in, 0s) forwards,
    breathe var(--dur, 5s) ease-in-out var(--delay, 0s) infinite alternate;
  will-change: transform, font-variation-settings;
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0) skewX(0); }
}
@keyframes breathe {
  from { font-variation-settings: 'wdth' var(--wmin, 70), 'wght' 600; }
  to   { font-variation-settings: 'wdth' var(--wmax, 140), 'wght' 900; }
}

/* ---------------------------------------------------------------- hud */
.hud {
  position: fixed;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--hud);
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink);
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity .8s var(--ease) .4s;
  max-width: 60vw;
}
html.ready .hud { opacity: 1; }
html.ui-hidden .hud, html.ui-hidden .cursor, html.ui-hidden .toast, html.ui-hidden .speed { opacity: 0 !important; pointer-events: none; }
.hud.tl { top: var(--pad); left: var(--pad); }
.hud.tr { top: var(--pad); right: var(--pad); align-items: flex-end; text-align: right; }
.hud.bl { bottom: calc(var(--mark) * 1.0 + var(--pad) * 0.6); left: var(--pad); }
.hud.br { bottom: calc(var(--mark) * 1.0 + var(--pad) * 0.6); right: var(--pad); flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 70vw; }
.hud a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
.hud a:hover, .hud a:focus-visible { border-color: currentColor; outline: none; }
.brand { font-weight: 700; }
.sub, .dim, .hint { opacity: .62; }
.world-hint { opacity: .95; }
.world-hint:empty { display: none; }
.row { display: inline-flex; gap: 10px; }
.fps { font-size: 9px; letter-spacing: .1em; }
.seed {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: .18em;
  font-weight: 700;
  cursor: pointer;
  text-transform: none;
  border-bottom: 1px dashed rgba(255,255,255,.5);
}
.seed:hover, .seed:focus-visible { border-bottom-style: solid; outline: none; }

.ctl {
  appearance: none;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  font: inherit;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 7px 12px 6px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s var(--ease);
}
.ctl:hover, .ctl:focus-visible { background: var(--ink); color: #000; outline: none; transform: translateY(-1px); }
.ctl:active { transform: translateY(0) scale(.97); }
.ctl[aria-pressed="true"] { background: var(--ink); color: #000; }

/* ---------------------------------------------------------------- transient bits */
.speed, .toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: var(--hud);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.speed { top: var(--pad); }
.toast { bottom: calc(var(--mark) * 1.0 + var(--pad) * 0.6 + 40px); }
.speed.show, .toast.show { opacity: 1; }

/* ---------------------------------------------------------------- cursor */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 26px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 10;
  display: none;
  transition: width .18s var(--ease), height .18s var(--ease), border-width .18s;
}
html.has-cursor .cursor { display: block; }
.cursor.down { width: 54px; height: 54px; border-width: 2.5px; }
.cursor::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
  background: var(--ink); border-radius: 50%; transform: translate(-50%, -50%);
}

/* ---------------------------------------------------------------- help */
.help {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}
.help.open { opacity: 1; pointer-events: auto; }
.help-card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.35);
  padding: clamp(18px, 3vw, 34px);
  background: rgba(0,0,0,.35);
  transform: translateY(14px);
  transition: transform .45s var(--ease);
  letter-spacing: .06em;
  line-height: 1.6;
  font-size: 12px;
}
.help.open .help-card { transform: none; }
.help-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-variation-settings: 'wdth' 125, 'wght' 900;
  font-size: clamp(34px, 6vw, 56px);
  line-height: .9;
  letter-spacing: -.02em;
}
.help-lede { margin: 0 0 18px; opacity: .85; }
.help a { color: inherit; }
.keys { margin: 0 0 18px; display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.keys dt { text-transform: uppercase; letter-spacing: .14em; opacity: .95; white-space: nowrap; }
.keys dd { margin: 0; opacity: .7; }
.help-foot { margin: 0; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .5; }

.noscript {
  position: fixed; inset: auto var(--pad) var(--pad); z-index: 30;
  text-transform: uppercase; letter-spacing: .14em;
}

/* ---------------------------------------------------------------- fallback without WebGL2 */
html.no-gl #gl { display: none; }
html.no-gl body {
  background: #000;
}
html.no-gl body::before {
  content: '';
  position: fixed; inset: -30%;
  background:
    radial-gradient(40% 50% at 30% 30%, #ff3d81 0%, transparent 60%),
    radial-gradient(50% 40% at 70% 65%, #00e5c8 0%, transparent 60%),
    radial-gradient(35% 45% at 55% 20%, #ffd23f 0%, transparent 60%),
    radial-gradient(45% 45% at 20% 80%, #5b3dff 0%, transparent 60%),
    #050505;
  filter: blur(40px) saturate(1.4);
  animation: swirl 24s ease-in-out infinite alternate;
}
@keyframes swirl {
  to { transform: rotate(12deg) scale(1.15) translate(4%, -3%); }
}
html.no-gl .hud { opacity: 1; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 700px) {
  :root { --hud: 10px; }
  :root { --mark: 23vw; }
  .hud { max-width: 80vw; }
  .hud.bl { bottom: calc(var(--mark) * 1.0 + var(--pad) * 0.6 + 82px); max-width: calc(100vw - 2 * var(--pad)); }
  .hud.bl .keys { display: none; }
  .hud.br { left: var(--pad); right: var(--pad); max-width: none; justify-content: flex-start; }
  .fps { display: none; }
  .help-card { font-size: 11px; }
}

/* ---------------------------------------------------------------- motion preferences */
@media (prefers-reduced-motion: reduce) {
  .mark span { animation: rise .01s forwards; transform: none; opacity: 1; }
  .help, .help-card, .ctl { transition: none; }
  html.no-gl body::before { animation: none; }
}
