/* About: the closing band. Owned by the About next section agent (About page 100x work, 2026-09-24).
   The shared .next band lives in site.css; everything here is scoped under .about-next.

   Two doors, one wall: the research (every paper as a square, oldest first, this year's ringed) and
   the fellows (every name, in the order they arrived). Both are readable at rest. Pointing at a door
   lifts it and quiets the other; pointing at a square or a name previews that paper or that fellow in
   the door's own line. The only click is the one that goes to the page. */

.about-next {
  --an-ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --an-vis-h: 13.5rem;
  padding-block: clamp(4.5rem, 9vw, 7.5rem);
}
.about-next__h { max-width: 20ch; text-wrap: balance; }

/* The wall: a wide door and a narrower one, a hairline seam between them */
.about-next__doors {
  margin-top: clamp(2.5rem, 5vw, 3.75rem);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-rows: auto auto auto;
  column-gap: clamp(2.5rem, 6vw, 6rem);
  position: relative;
}
/* Each door spans the wall's three rows (picture, name, line), so both names sit on one line */
.about-next-door {
  position: relative;
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 1.35rem;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.5s var(--an-ease);
}
.about-next-door--teaching::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(clamp(2.5rem, 6vw, 6rem) / -2);
  width: 1px;
  background: var(--line-2);
}
/* The lit door: a white plate that only exists while you point at it (or tab to it) */
.about-next-door { isolation: isolate; }
.about-next-door::after {
  content: '';
  position: absolute;
  inset: -1.5rem -1.75rem;
  z-index: -1;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.5s var(--an-ease), transform 0.6s var(--an-ease);
  pointer-events: none;
}
.about-next-door:focus-visible::after { opacity: 1; transform: none; }
.about-next-door:focus-visible { outline: none; }
.about-next-door:focus-visible .about-next-door__t { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 2px; }

/* The picture of each door. Height is reserved so nothing jumps when the data arrives. */
.about-next-door__vis {
  display: block;
  position: relative;
  min-height: var(--an-vis-h);
  transition: transform 0.6s var(--an-ease);
}
html:not(.js) .about-next-door__vis { display: none; }

/* Research: every paper as a square, filled column by column so time runs left to right */
.about-next-waffle {
  --r: 12;
  display: grid;
  gap: 3px;
}
.about-next-waffle i {
  display: block;
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--lightbox);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.4s var(--an-ease), transform 0.5s var(--an-ease), background-color 0.2s, box-shadow 0.3s;
}
.about-next-waffle i.is-led { background: var(--accent); }
.about-next-waffle i.is-ed { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent); }
.about-next.is-in .about-next-waffle i { opacity: 1; transform: none; }
.about-next-waffle.is-scrub i:not(.is-y) { opacity: 0.3; }
.about-next-waffle i.is-on,
.about-next.is-in .about-next-waffle i.is-on { background: var(--ink); box-shadow: none; transform: scale(1.45); position: relative; z-index: 1; }
.about-next-waffle__ends {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  font-family: var(--label);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.5s var(--an-ease) 1.1s;
}
.about-next.is-in .about-next-waffle__ends { opacity: 1; }
.about-next-waffle__ends b { font-weight: 600; color: var(--ink); }
.about-next-waffle__ends > span:last-child { text-align: right; }

/* Teaching: every fellow by name, in the order they arrived, each year marked once. The roll fills
   whatever height the squares take and never adds its own, so the two doors stay level. Pointing
   down the roll eases it upward to the later names; its fades follow (top once it has moved, none at
   the bottom once it reaches the newest). */
.about-next-roll {
  position: absolute;
  inset: 0;
  overflow: hidden;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-2);
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent);
  mask-image: linear-gradient(180deg, #000 72%, transparent);
}
.about-next-roll.is-down { -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 74%, transparent); mask-image: linear-gradient(180deg, transparent, #000 18%, #000 74%, transparent); }
.about-next-roll.is-down.is-end { -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%); mask-image: linear-gradient(180deg, transparent, #000 18%); }
.about-next-roll__in { display: block; will-change: transform; }
.about-next-roll__g { white-space: nowrap; }
.about-next-roll__n,
.about-next-roll__y {
  display: inline-block;
  margin-right: 0.7em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s var(--an-ease), transform 0.5s var(--an-ease), color 0.25s var(--an-ease);
}
.about-next-roll__y {
  font-family: var(--label);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
  margin-right: 0.45em;
}
.about-next.is-in .about-next-roll__n,
.about-next.is-in .about-next-roll__y { opacity: 1; transform: none; }
.about-next-roll.is-scrub .about-next-roll__n:not(.is-y),
.about-next-roll.is-scrub .about-next-roll__y:not(.is-y) { opacity: 0.36; }
.about-next-roll__n.is-on { color: var(--accent-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* While the band fills, each mark waits its turn; afterwards hover answers at once */
.about-next:not(.is-done) .about-next-waffle i,
.about-next:not(.is-done) .about-next-roll__n,
.about-next:not(.is-done) .about-next-roll__y { transition-delay: var(--d, 0ms); }

/* The door's name and its one line */
.about-next-door__t {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: start;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.012em;
  color: var(--ink);
  transition: color 0.35s var(--an-ease);
}
.about-next-door__arrow {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s var(--an-ease);
}

/* The line: at rest it says what the picture is; while pointing it previews one paper or one fellow.
   Both states share one grid cell, so the swap never moves the page. */
.about-next-door__d {
  display: grid;
  max-width: 50ch;
  min-height: calc(2 * 1.5em);
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--muted);
}
.about-next-say {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(8px);
  filter: blur(4px);
  transition: opacity 0.45s var(--an-ease), transform 0.5s var(--an-ease), filter 0.45s var(--an-ease);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.about-next-say.is-on { opacity: 1; transform: none; filter: none; }
.about-next-say b { font-family: var(--label); font-weight: 600; color: var(--accent); margin-right: 0.45rem; }
.about-next-say__who { color: var(--ink); font-weight: 500; }

/* Pointing at a door: it rises and its arrow moves; the other door steps back */
@media (hover: hover) and (pointer: fine) {
  .about-next-door:hover::after { opacity: 1; transform: none; }
  .about-next-door:hover .about-next-door__vis { transform: translateY(-3px); }
  .about-next-door:hover .about-next-door__t { color: var(--accent-deep); }
  .about-next-door:hover .about-next-door__arrow { transform: translateX(5px); }
  .about-next-waffle i, .about-next-roll__n { cursor: pointer; }
}
.about-next-door:focus-visible .about-next-door__arrow { transform: translateX(5px); }
.about-next[data-about-next-lit="research"] .about-next-door--teaching,
.about-next[data-about-next-lit="teaching"] .about-next-door--research { opacity: 0.42; }
.about-next.is-bare .about-next-door__vis { display: none; }

/* Phone and narrow tablet: the doors stack, the seam turns flat */
@media (max-width: 860px) {
  .about-next { --an-vis-h: 12.5rem; }
  .about-next__doors { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 3.5rem; }
  .about-next-door { grid-row: auto; grid-template-rows: auto auto auto; }
  .about-next-door--teaching::before { top: -1.75rem; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }
  .about-next-door::after { inset: -1rem -0.75rem; }
  .about-next-waffle { --r: 16; gap: 2px; }
  .about-next-roll { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .about-next-waffle i, .about-next-roll__n, .about-next-roll__y, .about-next-waffle__ends { opacity: 1; transform: none; transition: none; }
  .about-next-say { transform: none; filter: none; }
}
