/* ==========================================================================
   catalog.css — card-catalogue cabinets and subject drawers
   A drawer is an oak front with a brass label holder and a cup pull; on
   hover/focus it slides out and its index cards rise into view.
   ========================================================================== */

.cabinet {
  position: relative;
  padding: 0 12px 14px;
  border-radius: 12px 12px 6px 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 19px),
    linear-gradient(180deg, #A5764A, #8A5E3A 30%, #6B4528);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .25),
    0 22px 40px -18px rgba(46, 28, 15, .55),
    0 4px 10px rgba(46, 28, 15, .18);
  scroll-margin-top: 16px;
}
.cabinet__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 -12px 12px;
  padding: 10px 18px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #7C5230, #5A3920);
  border-bottom: 3px solid var(--wood-dark);
  color: #F1E4C6;
}
.cabinet__title { margin: 0; font-size: 1.2rem; }
.cabinet__plate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, #F0D9A2, #D2A452 55%, #B8893B);
  color: #2A1C06;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .6);
  font-family: var(--font-title);
}
.cabinet__plate::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--g0, #5C5446);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .25);
}
.cabinet__meta { margin: 0; font-size: .875rem; color: #E6D5B0; }

.cabinet__drawers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr));
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .1)),
    #3E2715;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, .55);
}
@media (max-width: 479px) {
  .cabinet__drawers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 8px; }
}

/* --------------------------------------------------------------------------
   Drawer
   -------------------------------------------------------------------------- */
.drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-top: 22px;       /* room for the rising cards */
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
}
.drawer:hover { color: var(--ink); }
.drawer:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 3px; }

.drawer__box {
  position: relative;
  height: 112px;
  border-radius: 6px;
  /* the dark cavity the drawer slides out of */
  background: linear-gradient(180deg, #1E1209, #2C1A0D);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .8);
}

.drawer__cards {
  position: absolute;
  top: 8px;
  left: 18px;
  right: 18px;
  height: 74px;
  pointer-events: none;
}
.drawer__card {
  position: absolute;
  inset: 0;
  border-radius: 3px 3px 0 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 9px, rgba(14, 5, 131, .14) 9px 10px) 0 16px / 100% calc(100% - 16px) no-repeat,
    linear-gradient(180deg, #FFFDF7, #F4EAD4);
  box-shadow: 0 -1px 2px rgba(0, 0, 0, .25);
  transform: translate3d(0, 26px, 0);
  transition: transform .45s var(--spring);
}
.drawer__card::before {
  /* coloured index tab = subject group */
  content: "";
  position: absolute;
  top: -7px;
  width: 30%;
  height: 9px;
  border-radius: 3px 3px 0 0;
  background: var(--g0, #5C5446);
}
.drawer__card:nth-child(1) { left: 6px; right: 6px; }
.drawer__card:nth-child(1)::before { right: 12%; }
.drawer__card:nth-child(2) { left: 3px; right: 3px; }
.drawer__card:nth-child(2)::before { right: 40%; background: var(--g2, #6B6253); }
.drawer__card:nth-child(3)::before { left: 10%; background: var(--g1, #4E473B); }

.drawer__front {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, .04) 0 3px, transparent 3px 11px),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #C1905E, #A87948 45%, #8C603A);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .35),
    inset 0 -2px 0 rgba(0, 0, 0, .25),
    inset 0 0 0 1px rgba(60, 35, 15, .35),
    0 2px 3px rgba(0, 0, 0, .45);
  transform-origin: 50% 100%;
  transition: transform .45s var(--ease);
}
.drawer__front::after {
  /* stronger shadow when pulled out (opacity only) */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 14px 18px -6px rgba(0, 0, 0, .65);
  opacity: 0;
  transition: opacity .45s var(--ease);
  pointer-events: none;
}

/* brass label holder with the subject name on a card */
.drawer__holder {
  position: relative;
  width: 100%;
  max-width: 190px;
  padding: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, #F2DCA6, #C99A48 50%, #A87C33);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.drawer__holder::before, .drawer__holder::after {
  /* rivets */
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: #6F511F;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.drawer__holder::before { right: -7px; }
.drawer__holder::after { left: -7px; }
.drawer__label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.9em;
  padding: 3px 6px;
  border-radius: 1px;
  background: linear-gradient(180deg, #FFFDF6, #F2E8D2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
  font-weight: 600;
  font-size: .9063rem;
  line-height: 1.45;
  text-align: center;
  color: var(--ink);
  border-top: 3px solid var(--g0, #5C5446);
}

/* cup pull */
.drawer__pull {
  width: 56px;
  height: 18px;
  border-radius: 0 0 28px 28px / 0 0 18px 18px;
  background: linear-gradient(180deg, #5C4318 0 3px, #E8CB86 3px, #B8893B 60%, #7A5A22);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .45), inset 0 -2px 3px rgba(0, 0, 0, .25);
}

.drawer__count {
  margin-top: 8px;
  font-size: .8125rem;
  font-weight: 600;
  text-align: center;
  color: #EADBB8;
  font-variant-numeric: tabular-nums;
}

/* pulled out ------------------------------------------------------------------ */
.drawer:hover .drawer__front,
.drawer:focus-visible .drawer__front { transform: translate3d(0, 9px, 0) scale(1.045); }
.drawer:hover .drawer__front::after,
.drawer:focus-visible .drawer__front::after { opacity: 1; }
.drawer:hover .drawer__card,
.drawer:focus-visible .drawer__card { transform: translate3d(0, -12px, 0); }
.drawer:hover .drawer__card:nth-child(2),
.drawer:focus-visible .drawer__card:nth-child(2) { transform: translate3d(0, -18px, 0); transition-delay: .05s; }
.drawer:hover .drawer__card:nth-child(3),
.drawer:focus-visible .drawer__card:nth-child(3) { transform: translate3d(0, -24px, 0); transition-delay: .1s; }
.drawer:active .drawer__front { transform: translate3d(0, 12px, 0) scale(1.05); }

/* home: a single cabinet with the 12 largest subjects */
.cabinet--home .cabinet__drawers { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
@media (max-width: 479px) {
  .cabinet--home .cabinet__drawers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cabinet__foot {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

/* group index chips (subjects page) */
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 14px 4px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .2s, transform .2s var(--ease);
}
.group-chip::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--g0, #5C5446);
}
.group-chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.group-chip .chip__count { font-size: .78rem; }
