/* The drawer: a wooden drawer front under the desk's scripts, with a brass card frame and pull. Pulled open, the
   scripts put away lie in it as manila folders, sliding out once. */
.drawer {
  max-width: 64rem;
  margin: 4rem auto 2rem;
}

.drawer__front {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 1rem 1rem 1.2rem;
  border-radius: 4px;
  background:
    repeating-linear-gradient(178deg, rgb(255 255 255 / 0.025) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, #5a3a26, #432a1b);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), inset 0 -2px 0 rgb(0 0 0 / 0.35), 0 6px 14px rgb(0 0 0 / 0.45);
  list-style: none;
  cursor: pointer;
}
.drawer__front::-webkit-details-marker { display: none; }
.drawer__front:focus-visible { outline: 2px solid var(--chrome-muted); outline-offset: 3px; }

/* A label card slipped into a brass frame. */
.drawer__label {
  padding: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #e3c37a, #a07a32);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.5);
}
.drawer__label-card {
  display: block;
  padding: 0.15rem 0.9rem;
  border-radius: 1px;
  background: #f6efdc;
  color: #2a2620;
  font: 1.05rem/1.3 var(--font-hand);
}

/* The pull: a brass bar on two posts. */
.drawer__pull {
  width: 6.5rem;
  height: 0.7rem;
  border-radius: 0.35rem;
  background: linear-gradient(180deg, #f1d58f, #b48a3c 55%, #7d5d22);
  box-shadow: 0 3px 4px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.4);
  transition: translate 160ms ease;
}
.drawer__front:hover .drawer__pull { translate: 0 1px; }
.drawer[open] .drawer__front { border-radius: 4px 4px 0 0; }

/* Inside: the drawer's dark box, the folders lying in it. */
.drawer__folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1.4rem 1rem;
  margin: 0;
  padding: 1.6rem 1.2rem 1.4rem;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, #120a06, #24160e);
  box-shadow: inset 0 8px 16px rgb(0 0 0 / 0.6);
  list-style: none;
}
.drawer[open] .drawer__folders { animation: drawer-out 360ms cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes drawer-out { from { opacity: 0; translate: 0 -1.5rem; } }

.folder {
  position: relative;
  display: grid;
  gap: 0.35rem;
  padding: 1.6rem 0.9rem 0.8rem;
  border-radius: 2px 6px 3px 3px;
  background: linear-gradient(176deg, #ead9ae, #dcc690);
  color: #3a2f1c;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.5);
}
.folder:nth-child(3n + 1) { rotate: -0.6deg; }
.folder:nth-child(3n + 2) { rotate: 0.5deg; }

/* The tab along the top edge, with the title written on it. */
.folder__tab {
  position: absolute;
  top: -0.85rem;
  left: 0.6rem;
  max-width: 75%;
  padding: 0.15rem 0.7rem 0.1rem;
  border-radius: 5px 5px 0 0;
  background: #ead9ae;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder__tab:hover .folder__title, .folder__tab:focus-visible .folder__title { text-decoration: underline; }
.folder__title { font: 600 1rem/1.3 var(--font-hand); }
.folder__meta { font: 0.8rem var(--font-ui); color: #6b5a3a; }
.folder__out { justify-self: start; color: #3a2f1c; }

@media (prefers-reduced-motion: reduce) { .drawer[open] .drawer__folders { animation: none; } }

/* Back out on the desk: the script settles into place, once. */
.pad--taken-out { animation: taken-out 520ms cubic-bezier(0.3, 0.9, 0.35, 1.15); }
@keyframes taken-out { from { opacity: 0; translate: 0 2.5rem; rotate: 2deg; } }
@media (prefers-reduced-motion: reduce) { .pad--taken-out { animation: none; } }
