:root {
  --ink: #111;
  --muted: #8a8a8a;
  --paper: #fff;
  --panel-pad: clamp(1.25rem, 2.6vw, 2.5rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.45 "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Ring stage ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Text ---------- */

/* Upper left: name and bio, then a wide line of publications, then the links. */
.panel {
  position: fixed;
  z-index: 2;
  left: 6vw;
  top: 27vh;
  width: min(44vw, 44rem);
  display: grid;
  gap: 1.5rem;
  pointer-events: none;
}
.panel > * { pointer-events: auto; }
/* Soft white field so photos passing behind never fight the text. */
.panel::before {
  content: "";
  position: absolute;
  inset: -5rem -6rem;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.8) 55%, rgba(255, 255, 255, 0));
  pointer-events: none;
  /* Only there once the text is: it fades in as the typing starts. */
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.is-ready .panel::before { opacity: 1; }

.panel p { margin: 0; }
.name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.muted { color: var(--muted); }

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.6rem;
}
.links a,
.link-button {
  color: var(--ink);
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(17, 17, 17, 0.35);
  transition: text-decoration-color 0.25s var(--ease-out);
}
.links a:hover,
.link-button:hover,
.links a:focus-visible,
.link-button:focus-visible { text-decoration-color: currentColor; }

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

.pubs h2 {
  margin: 0 0 0.3rem;
  font: inherit;
}
.pubs ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
}

.panel__foot {
  display: flex;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

/* Text arrives after the photos start flowing in. */
.reveal { opacity: 0; }
.is-ready .reveal { opacity: 1; }

/* Typed out letter by letter (type.js); the full text stays readable to screen readers. */
.type-word { white-space: nowrap; }
.type-char, .type-wait { opacity: 0; transition: opacity 0.12s linear; }
.type-char.is-typed, .type-wait.is-typed { opacity: 1; }
.links .is-typing { text-decoration-color: transparent; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--panel-pad);
  border: 0;
  background: var(--paper);
  color: var(--ink);
  display: none;
  flex-direction: column;
  gap: 1rem;
}
.lightbox[open] { display: flex; animation: fade-in 0.35s var(--ease-out); }
/* While a photo flies out of the ring the viewer is open but see-through; once it lands,
   the paper, the full-size image and the controls fade in over it. */
.lightbox { transition: background-color 0.35s var(--ease-out); }
.lightbox__bar, .lightbox__figure img { transition: opacity 0.35s var(--ease-out); }
.lightbox.is-flying { background: transparent; animation: none; }
.panel { transition: opacity 0.35s var(--ease-out); }
.is-viewing .panel { opacity: 0; }
.lightbox.is-flying .lightbox__bar,
.lightbox.is-flying .lightbox__figure img { opacity: 0; }
.lightbox::backdrop { background: transparent; }

.lightbox__figure {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0;
}
.lightbox__figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: fade-in 0.4s var(--ease-out);
}
.lightbox__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.lightbox__nav { display: flex; gap: 1.25rem; }
.lightbox__nav button {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0.25rem 0;
  cursor: pointer;
}
.lightbox__nav button:hover { color: var(--muted); }

@keyframes fade-in { from { opacity: 0; } }

/* ---------- Smaller screens ---------- */

@media (max-width: 1280px) {
  .panel { width: min(52vw, 40rem); left: 5vw; }
}

@media (max-width: 700px) {
  .panel {
    left: 0;
    top: 0;
    width: 100%;
    transform: none;
    padding: 1.25rem;
    gap: 0.75rem;
  }
  .panel::before { inset: -2rem -2rem -4rem; border-radius: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 70%, rgba(255, 255, 255, 0)); }
  .panel__foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .lightbox[open], .lightbox__figure img { transition: none; animation: none; }
}
