/* The residents' flip book at the top of the Team tab (cloud/residents.js): one resident's portrait
 * after another, then UCLA NEUROSURGERY, in the site's palette. Its lettering is Anton (SIL Open Font
 * License 1.1). */

.pp-res {
  position: relative;
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, 21rem);
  margin-bottom: 0.8rem;
  border: 3px solid var(--kb-ink);
  box-shadow: 6px 6px 0 var(--kb-ink);
  background: var(--kb-paper-2);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  transition: border-color 0.7s, box-shadow 0.7s;
}
/* at the end the video goes and only the title stays: no frame, no shadow, the box closed in round
   the words (its height is the title's; residents.js sets --pp-res-band and closes it smoothly) */
.pp-res.is-title {
  aspect-ratio: var(--pp-res-band, 900 / 240);
  border-color: transparent;
  box-shadow: 0 0 0 0 transparent;
}
.pp-res.is-title .pp-res__book:focus-visible {
  outline: 2px solid var(--kb-accent);
  outline-offset: 4px;
}
/* until it first comes into sight (a line, so it can tell) */
.pp-res:empty {
  aspect-ratio: auto;
  min-height: 1px;
  border: 0;
  box-shadow: none;
  background: none;
}

/* the portraits, stacked; only the one showing is drawn */
.pp-res__book {
  position: absolute;
  inset: 0;
  /* nothing shows until the faces are in */
  opacity: 0;
  transition: opacity 0.3s;
}
.pp-res.is-on .pp-res__book {
  opacity: 1;
}
.pp-res__book img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  visibility: hidden;
}
.pp-res__book img.is-shown {
  visibility: visible;
}
/* the title, over the portraits in the last round (cloud/residents.js) */
.pp-res__title {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}
.pp-res__title.is-on {
  display: block;
}
.pp-res__word {
  font-family: Anton, var(--kb-sans);
  font-weight: 400;
}
/* the ending (cloud/residents.js outro): hidden until it starts; then the words in place of the
   clipped letters, which they match exactly at first */
.pp-res__outro {
  display: none;
}
.pp-res__title.is-morphing .pp-res__outro {
  display: inline;
}
.pp-res__title.is-morphing > g[clip-path] {
  visibility: hidden;
}
.pp-res__paper {
  opacity: 0;
}
.pp-res__morph,
.pp-res__morph text {
  transform-box: view-box;
  transform-origin: 0 0;
}
.pp-res__plain {
  font-family: var(--kb-sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: 0;
}
.pp-res__rule {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleX(0);
}

/* the corner icons: pause (play), then replay; small, see-through until pointed at */
.pp-res__ctl {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(239, 238, 232, 0.72);
  box-shadow: 0 0 0 1px rgba(40, 40, 40, 0.14);
  color: var(--kb-ink);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s;
}
.pp-res__ctl svg {
  width: 0.65rem;
  height: 0.65rem;
  fill: currentColor;
}
.pp-res__ctl:hover,
.pp-res__ctl:focus-visible {
  opacity: 1;
}
.pp-res__ctl:focus-visible {
  outline: 2px solid var(--kb-accent);
  outline-offset: 2px;
}
/* at rest as a title, a click on it plays it again (nothing else shows that it can) */
.pp-res.is-ended .pp-res__book {
  cursor: pointer;
}
.pp-res__ctl[hidden] {
  display: none;
}

/* the Team list and Add a person stay admins' (cloud/team.js sets pp-is-admin) */
body:not(.pp-is-admin) #pane-team .pp-admin-only {
  display: none;
}

@media (max-width: 40rem) {
  .pp-res {
    box-shadow: 4px 4px 0 var(--kb-ink);
  }
}
