@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --ground: #10141d;
  --stripe: rgba(242, 240, 233, 0.035);
  --surface: #1c212e;
  --surface-line: rgba(158, 167, 183, 0.18);
  --ink: #f2f0e9;
  --muted: #9ea7b7;
  --glow: #8ad4ff;
  --iris: #2b6cd4;
  --cta-ink: #0b1220;
  --halo: 0.28;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #f4f5f8;
    --stripe: rgba(28, 33, 46, 0.06);
    --surface: #ffffff;
    --surface-line: rgba(28, 33, 46, 0.12);
    --ink: #1c212e;
    --muted: #5d6573;
    --glow: #2b6cd4;
    --iris: #2b6cd4;
    --cta-ink: #ffffff;
    --halo: 0.16;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background-color: var(--ground);
  /* The avatar's suiting cloth, at page scale. */
  background-image: repeating-linear-gradient(135deg, var(--stripe) 0 1px, transparent 1px 7px);
  font-family: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
}
[hidden] { display: none !important; }

.bar {
  position: fixed;
  inset: 0 0 auto auto;
  z-index: 2;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0 0;
}
.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lang button {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--ground); background: var(--ink); }

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 max(1.25rem, env(safe-area-inset-left)) 5rem;
}

/* --- hero ------------------------------------------------------------- */

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 5rem);
  padding: 5rem 0 3rem;
}
.stage {
  position: relative;
  justify-self: end;
  width: min(100%, 26rem);
  aspect-ratio: 1;
}
/* The light his eyes give off — it rises when they switch on. */
.stage::before {
  content: "";
  position: absolute;
  inset: 8% 8% 30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  opacity: 0;
  filter: blur(28px);
  transition: opacity 900ms ease-out;
}
.stage.awake::before { opacity: var(--halo); }
.stage canvas, .stage .fallback {
  position: relative;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.stage canvas { display: none; }
.js .stage canvas { display: block; }
.js .stage .fallback { display: none; }

.name {
  margin: 0;
  font-size: clamp(5rem, 16vw, 10.5rem);
  line-height: 0.86;
  font-weight: 800;
  letter-spacing: -0.045em;
}
.role {
  margin: 0.9rem 0 0;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 400;
  color: var(--muted);
  max-width: 28ch;
}
.actions { margin-top: 2.25rem; max-width: 28rem; }
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  color: var(--cta-ink);
  background: var(--glow);
  font-weight: 650;
  font-size: 1.0625rem;
  text-decoration: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 55%, transparent);
  transition: transform 160ms ease, box-shadow 400ms ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 10px 34px -10px var(--glow); }
.cta:active { transform: translateY(1px); }
.cta.handed { animation: handed 900ms ease-out; }
@keyframes handed {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 60%, transparent); }
  100% { box-shadow: 0 0 0 22px color-mix(in srgb, var(--glow) 0%, transparent); }
}
.cta:focus-visible, .lang button:focus-visible {
  outline: 3px solid var(--glow);
  outline-offset: 4px;
}
.hint { margin: 1rem 0 0; color: var(--muted); font-size: 0.9375rem; }
.status { margin: 0.5rem 0 0; color: var(--glow); font-size: 0.9375rem; font-weight: 600; }
.status:empty { display: none; }

/* The intro arrives with the boot sequence, not before. */
.js .intro { opacity: 0; transform: translateY(10px); filter: blur(6px); }
.js .intro.on {
  opacity: 1; transform: none; filter: none;
  transition: opacity 700ms ease-out, transform 700ms ease-out, filter 700ms ease-out;
}

/* --- the conversation --------------------------------------------------- */

.thread {
  max-width: 40rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.thread > div { display: flex; flex-direction: column; gap: 0.6rem; }
.msg { display: flex; }
.msg p {
  margin: 0;
  max-width: 34rem;
  padding: 0.75rem 1.05rem;
  border-radius: 1.25rem;
}
.ask { justify-content: flex-end; margin-top: 1.4rem; }
.ask p {
  border: 1px solid var(--surface-line);
  border-bottom-right-radius: 0.4rem;
  color: var(--ink);
  font-weight: 600;
}
.say { gap: 0.6rem; align-items: flex-end; }
.say::before {
  content: "";
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: url("/james.png") center / cover;
  image-rendering: pixelated;
}
.say p {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-bottom-left-radius: 0.4rem;
}
/* Typing, then the answer — played once when the thread comes into view. */
.js .thread .msg { opacity: 0; transform: translateY(8px); }
.js .thread .msg.in { opacity: 1; transform: none; transition: opacity 380ms ease-out, transform 380ms ease-out; }
.say.typing p { color: transparent; position: relative; min-width: 4.2rem; max-height: 2.9rem; overflow: hidden; }
.say.typing p::after {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.225rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0.8rem 0 0 var(--muted), 1.6rem 0 0 var(--muted);
  animation: dots 900ms infinite ease-in-out;
}
@keyframes dots { 50% { opacity: 0.35; } }

/* --- small screens -------------------------------------------------------- */

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 1.25rem;
    padding-top: 4.5rem;
  }
  .stage { justify-self: start; width: min(72vw, 18rem); }
  .name { font-size: clamp(4.5rem, 24vw, 7rem); }
}

@media (prefers-reduced-motion: reduce) {
  .js .intro, .js .thread .msg { opacity: 1; transform: none; filter: none; transition: none; }
  .cta, .stage::before { transition: none; }
  .cta.handed, .say.typing p::after { animation: none; }
}
