/* The drawer both reader pages of a study major carry: every lesson of the
   major, numbered, grouped by the course it belongs to.

   The look is the one the playlist player and the 法本 reader already use - off
   the left edge, a handle in the bottom-left corner of every page that has one -
   so a reader who has met one of them has met all three. What is different is
   what a major needs and neither of the others has: a dozen courses in one list,
   and a tick against what is already done. */
.mjd {
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  /* Out of the flow entirely, and off the tab order until it is opened. */
  visibility: hidden;
  z-index: 60;
}

.mjd.is-drawer-open {
  visibility: visible;
}

.mjd__scrim {
  background-color: rgba(40, 38, 30, 0.35);
  height: 100%;
  opacity: 0;
  transition: opacity 0.2s ease;
  width: 100%;
}

.mjd.is-drawer-open .mjd__scrim {
  opacity: 1;
}

.mjd__panel {
  background-color: #f6f5ea;
  border-right: 1px solid #d9d9c6;
  box-shadow: 2px 0 14px rgba(78, 13, 13, 0.12);
  display: flex;
  flex-direction: column;
  height: 100%;
  left: 0;
  max-width: 86vw;
  /* The foot clears the floating handle, which sits over this panel. */
  padding: 14px 0 76px;
  position: absolute;
  text-align: left;
  top: 0;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  width: 340px;
}

.mjd.is-drawer-open .mjd__panel {
  transform: translateX(0);
}

.mjd__head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e0cd;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 0 14px 8px;
}

.mjd__titles {
  min-width: 0;
}

.mjd__major {
  color: #4e0d0d;
  display: block;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1.05em;
  line-height: 1.4;
}

.mjd__count {
  color: #8a8a78;
  font-size: 0.82em;
}

.mjd__close {
  background: none;
  border: 0;
  color: #8a8a78;
  cursor: pointer;
  font-size: 1.4em;
  line-height: 1;
  padding: 0 2px;
}

.mjd__close:hover {
  color: #4e0d0d;
}

.mjd__progress {
  padding: 8px 14px 0;
}

.mjd__progress .progress-mini {
  width: 100%;
}

/* The list takes whatever height the panel has left, so 本专业全部课程 sits at its
   foot rather than halfway up it after a major of four lessons. */
.mjd__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 0;
}

/* Which course the rows under it belong to. Sticky: a course of 201 lessons is
   many screens of scrolling, and the reader loses the heading on the first
   flick. */
.mjd__group {
  background-color: #efeee0;
  border-bottom: 1px solid #e2e0cd;
  color: #6f6f5e;
  font-size: 0.82em;
  padding: 5px 14px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mjd__lessons {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mjd__item {
  align-items: baseline;
  border-bottom: 1px solid #efeada;
  display: flex;
  font-size: 0.9em;
  gap: 8px;
  padding: 6px 14px;
}

.mjd__item a {
  color: #1a5276;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mjd__item a:hover {
  text-decoration: underline;
}

.mjd__order {
  color: #8f8f80;
  font-size: 0.9em;
  min-width: 2.4em;
  text-align: right;
}

.mjd__duration {
  color: #8f8f80;
  font-size: 0.85em;
  white-space: nowrap;
}

/* Done steps back rather than shouting: what the reader is looking for in this
   list is the lessons that are not. */
.mjd__item.is-done a {
  color: #8f8f80;
}

.mjd__item.is-done .mjd__order::after {
  color: #4a7c59;
  content: "✓";
  padding-left: 3px;
}

/* One half of the lesson done and the other not - watched but unread, or read
   but unwatched. It used to take the same ✓ as a lesson that was finished,
   because each page marked only its own half of the pair. */
.mjd__item.is-half .mjd__order::after {
  color: #a8a894;
  content: "—";
  padding-left: 3px;
}

.mjd__item.is-current {
  background-color: #f2e7cf;
}

.mjd__item.is-current a {
  color: #4e0d0d;
  font-weight: bold;
}

.mjd__all {
  border-top: 1px solid #e2e0cd;
  color: #4a7c59;
  font-size: 0.85em;
  margin-top: auto;
  padding: 10px 14px 0;
  text-decoration: none;
}

.mjd__all:hover {
  text-decoration: underline;
}

/* The same handle again, pinned to the corner: the bar scrolls away on a 法本
   that can run tens of thousands of characters, and the player's own bar is off
   the top of the window as soon as anybody scrolls to the notes. */
.mjd__fab {
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #d9d9c6;
  border-radius: 50%;
  bottom: 26px;
  box-shadow: 0 2px 10px rgba(78, 13, 13, 0.14);
  color: #4a7c59;
  cursor: pointer;
  height: 42px;
  left: 18px;
  position: fixed;
  width: 42px;
  /* Above the scrim: the handle is the way out as well as the way in. */
  z-index: 70;
}

.mjd__fab:hover {
  border-color: #4a7c59;
}

@media screen and (max-width: 600px) {
  .mjd__fab {
    bottom: 18px;
    left: 12px;
  }
}
