:root {
  --bg: #f2f2f1;
  --ink: #1d1d1d;          /* name and darkest painting cells */
  --ink-soft: #3b3b3b;     /* bio text */
  --ink-muted: #6b6b6b;    /* credit */
  --tone-light: #d3d3d1;   /* lightest painting cells, just off the paper */
  --tone-dark: #2a2a2a;    /* darkest painting cells */
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  scrollbar-color: var(--tone-light) var(--bg);
}

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

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--bg); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* The stage pins for the whole scroll; scroll progress drives the canvas. */
.scrolly { position: relative; height: 320svh; }

/* Hero intro: scrolls away normally; the ASCII clears a space around it. */
.intro {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 1.5rem 1.75rem;
  font-family: var(--mono);
}

.intro-line {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

/* small name mark to the right of the tagline, same voice as the lines */
.intro-top {
  display: flex;
  align-items: flex-start;
  gap: clamp(2rem, 6vw, 5rem);
}

.intro-mark {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.intro-links {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.intro-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.25em;
  transition: color 0.2s var(--ease-out), text-decoration-color 0.2s var(--ease-out);
}

.intro-links a:hover,
.intro-links a:focus-visible { color: var(--ink); }

.logo {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: currentColor;
}

.intro-links a:hover,
.intro-links a:focus-visible { text-decoration-color: currentColor; }

/* Typeset name: sits exactly where the ASCII name assembled, then takes over. */
.name {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--name-top, 30%);
  margin: 0;
  font-size: var(--name-size, 8rem);
  font-weight: 800;
  line-height: var(--name-lh, 1);
  text-align: center;
  white-space: pre-line;
  color: var(--ink);
  opacity: var(--name-in, 0);
}

.stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}

#chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.bio {
  position: absolute;
  left: 50%;
  top: var(--bio-top, 64%);
  width: min(36rem, calc(100% - 2rem));
  margin: 0;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
  text-wrap: pretty;
  opacity: var(--bio-in, 0);
  transform: translate(-50%, calc((1 - var(--bio-in, 0)) * 1.25rem));
}

.credit {
  position: absolute;
  right: 1rem;
  bottom: 0.875rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  opacity: var(--credit-in, 1);
}

.credit a { color: inherit; text-underline-offset: 0.2em; }
.credit a:hover { color: var(--ink); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .credit { left: 1rem; right: auto; }
}

/* ---------- Boot terminal (plays over the page on load) ---------- */

html.booting { overflow: hidden; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  font-family: var(--mono);
  transition: opacity 0.45s var(--ease-out);
}

.boot.leaving { opacity: 0; pointer-events: none; }

/* sits where the intro block sits, so the hand-off lines up */
.boot-term {
  padding: 1.5rem 1.75rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.75;
  white-space: pre;
}

.boot-line { min-height: 1.75em; }
.boot-prompt { color: var(--ink-muted); }
.boot-typed { font-weight: 700; }
.boot-out { color: var(--ink-soft); }
.boot-ok { color: var(--ink); font-weight: 700; }

.boot-cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin-left: 0.08em;
  vertical-align: -0.18em;
  background: var(--ink);
  animation: boot-blink 1.06s steps(1) infinite;
}

.boot-cursor.solid { animation: none; }

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

.boot-skip {
  position: fixed;
  right: 1rem;
  bottom: 0.875rem;
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* the real intro text fades in as the terminal text fades out */
.intro { transition: opacity 0.6s var(--ease-out) 0.2s; }
html.booting .intro { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .boot-cursor { animation: none; }
  .boot,
  .intro { transition: none; }
}

/* ---------- Album cover (between the bio and the likes) ---------- */

.album {
  width: min(26rem, calc(100% - 2rem));
  margin: 4rem auto 0;
}

.album canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.album figcaption {
  margin-top: 0.875rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- Things I like doing (normal flow after the scroll sequence) ---------- */

.likes {
  max-width: 60rem;
  margin: 0 auto;
  padding: 6rem 1.75rem 8rem;
  background: var(--bg);
}

.likes-title {
  margin: 0 0 2.5rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink);
}

/* same prompt as the boot terminal */
.likes-title::before {
  content: "~ % ";
  color: var(--ink-muted);
}

.likes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 2.25rem 3rem;
}

.likes-list li {
  padding-top: 1rem;
  border-top: 1px solid var(--tone-light);
}

.likes-list h3 {
  margin: 0 0 0.375rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.likes-list p {
  margin: 0;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* ---------- Phones ---------- */

@media (max-width: 560px) {
  .intro { padding: 1.25rem 1rem; }

  .likes { padding: 4rem 1rem 5rem; }

  /* Xense sits above the tagline when there isn't room beside it */
  .intro-top {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .boot-term {
    padding: 1.25rem 1rem;
    font-size: 0.8125rem;
    white-space: pre-wrap; /* wrap rather than run off the side */
  }

  .credit {
    right: 1rem;
    font-size: 0.6875rem;
  }
}
