/* Fly Intelligence. One screen: his smoke, the brain, one line to type into.
   Colours are sampled off his plates: lime #C8F831 on #20252A. */

@font-face {
  font-family: "Satoshi";
  src: url("/assets/fonts/Satoshi-Variable.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --lime: #c8f831;
  --lime-dim: #9fc82a;
  --ink: #20252a;
  --white: #f2f5ee;
  --grey: #8d9a90;
  --grey-dim: #5d6a60;
  --sans: "Satoshi", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SF Mono", ui-monospace, monospace;
  --pad: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--white);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  cursor: url("/assets/img/cursor.png") 6 4, auto;
}

a, button, input, .chip { cursor: url("/assets/img/cursor@2x.png") 12 8, pointer; }
@media (max-resolution: 1.5dppx) {
  a, button, input, .chip { cursor: url("/assets/img/cursor.png") 6 4, pointer; }
}

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

/* ---- the world -------------------------------------------------------- */

.smoke {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
  filter: brightness(0.8) saturate(0.9);
  pointer-events: none;
}

.brain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
}

/* ---- top --------------------------------------------------------------- */

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--pad);
  pointer-events: none;
}
.top > * { pointer-events: auto; }

.mark { display: flex; flex-direction: column; gap: 2px; }
.name { font-weight: 700; font-size: clamp(18px, 1.6vw, 22px); letter-spacing: -0.01em; }
.ticker { color: var(--lime); font-weight: 700; font-size: clamp(14px, 1.2vw, 16px); }

.links { display: flex; gap: 10px; }

.tile {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 0; padding: 0; background: transparent;
  background-image: url("/assets/img/tile.webp");
  background-size: 100% 100%;
  color: inherit;
  transition: transform 120ms ease, filter 120ms ease;
}
.tile img { position: relative; display: block; }
.tile[hidden] { display: none; }
.tile:hover { filter: brightness(1.2); }
.tile:active { transform: translateY(1px) scale(0.97); }
.tile:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 12px; }
.tile[aria-disabled="true"] { filter: brightness(0.55) grayscale(0.4); }
.tile[aria-disabled="true"]:hover { filter: brightness(0.55) grayscale(0.4); }
.tile[aria-pressed="true"] { filter: brightness(1.15); }

/* ---- the column -------------------------------------------------------- */

.stage {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--pad) + 64px) var(--pad) calc(var(--pad) + 40px);
}

.spacer {
  flex: 1 1 auto;
  width: min(60vh, 60vw, 560px);
  min-height: 120px;
}

.console {
  width: min(100%, 640px);
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}

.answer {
  margin: 0;
  min-height: 2.6em;
  display: flex; align-items: flex-end; justify-content: center;
  text-align: center;
  color: var(--lime);
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-shadow: 0 0 18px rgba(200, 248, 49, 0.35);
}
.answer .tag { color: var(--white); font-weight: 500; text-shadow: none; }
.answer .w { display: inline-block; opacity: 0; transform: translateY(4px); animation: word 220ms ease forwards; }
@keyframes word { to { opacity: 1; transform: none; } }

.ask {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(200, 248, 49, 0.45);
  padding: 4px 0 8px;
  transition: border-color 150ms ease;
}
.ask:focus-within { border-bottom-color: var(--lime); }
.ask input {
  flex: 1 1 auto; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--white); font: inherit; font-size: clamp(17px, 1.5vw, 20px); font-weight: 500;
  caret-color: var(--lime);
  padding: 4px 0;
}
.ask input::placeholder { color: var(--grey); }
.ask input:disabled { color: var(--grey); }
.send {
  background: transparent; border: 0; padding: 4px 2px;
  color: var(--lime); font: inherit; font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em;
}
.send:hover { text-shadow: 0 0 10px rgba(200, 248, 49, 0.6); }
.send:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.send:disabled { color: var(--grey-dim); text-shadow: none; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.chip {
  background: transparent; border: 0; padding: 4px 0;
  color: var(--grey); font: inherit; font-size: 14px; font-weight: 500;
  transition: color 120ms ease;
}
.chip:hover { color: var(--white); }
.chip:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.chip:disabled { color: var(--grey-dim); }

.trace {
  width: 100%;
  margin: 6px 0 0;
  height: 7.4em;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--grey);
  white-space: pre-wrap;
  word-break: break-word;
}
.trace .k { color: var(--grey-dim); display: inline-block; width: 11ch; }
.trace .v { color: var(--grey); }
.trace .v b { color: var(--lime-dim); font-weight: 600; }
.trace .line { opacity: 0; animation: word 180ms ease forwards; }

/* ---- the bench: vial and tape ------------------------------------------ */

.bench {
  position: fixed; right: var(--pad); bottom: var(--pad); z-index: 3;
  display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 8px;
}
.vial {
  height: 150px; width: auto;
  display: block;
  filter: drop-shadow(0 0 22px rgba(200, 248, 49, 0.12));
  user-select: none;
}
.tape {
  position: relative;
  min-width: 300px;
  padding: 11px 18px 12px;
  margin-bottom: 4px;
  background: url("/assets/img/tape.webp") center / 100% 100% no-repeat;
  color: #1c2416;
  transform: rotate(1.2deg);
}
.ca {
  display: block; width: 100%;
  background: transparent; border: 0; padding: 0;
  font-family: var(--mono); font-size: 12px; font-weight: 600; line-height: 1.35;
  color: inherit; text-align: left;
  word-break: break-all; user-select: all;
}
.ca:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.tape[data-empty="true"] .ca { user-select: none; color: #4a5a44; font-weight: 500; }
.copied {
  position: absolute; left: 18px; bottom: -18px;
  font-size: 11px; font-weight: 700; color: var(--lime);
  font-family: var(--sans);
  opacity: 0; transition: opacity 150ms ease;
}
.copied[data-on="true"] { opacity: 1; }

/* ---- sizes -------------------------------------------------------------- */

@media (max-width: 1400px) {
  .tape { min-width: 250px; }
}

@media (max-width: 760px) {
  .stage { padding-top: calc(var(--pad) + 52px); padding-bottom: 96px; }
  .spacer { width: min(38vh, 72vw); min-height: 80px; }
  .console { gap: 10px; }
  .bench { left: 0; right: 0; bottom: 0; padding: 0 var(--pad) 10px; gap: 6px; flex-direction: row; }
  .vial { height: 78px; }
  .tape { min-width: 0; flex: 1 1 auto; padding: 8px 12px 9px; margin-bottom: 0; transform: rotate(-0.6deg); }
  .ca { font-size: 11px; }
  .copied { bottom: -16px; }
  .trace { height: 10.3em; font-size: 11px; }
  .trace .k { width: 10ch; }
  .chip { font-size: 13px; }
}

@media (max-height: 700px) {
  .stage { padding-top: calc(var(--pad) + 56px); }
  .spacer { min-height: 70px; }
  .answer { font-size: clamp(18px, 2vw, 22px); min-height: 2.4em; }
}

@media (max-width: 380px) {
  .links { gap: 6px; }
  .tile { width: 42px; height: 42px; }
  .trace { height: 12em; }
  .console { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .answer .w, .trace .line { animation: none; opacity: 1; transform: none; }
}
