/*
 * MEN'S LAB shelf experience
 * The open folio stays behind a real, independently selectable row of volumes.
 */

.ml-library-site .ml-premium-stage {
  height: clamp(680px, calc(100svh - 86px), 740px) !important;
  min-height: 680px !important;
  overflow: clip !important;
}

.ml-library-site .ml-premium-stage__intro {
  top: 42px !important;
  width: 270px !important;
}

.ml-library-site .ml-premium-stage__intro strong {
  font-size: 42px !important;
  line-height: 1.45 !important;
}

.ml-library-site .ml-open-book--material {
  top: 18px !important;
  left: 61% !important;
  z-index: 8 !important;
  width: min(56vw, 780px) !important;
  aspect-ratio: 3 / 2 !important;
  overflow: visible !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--visual {
  top: 15.2% !important;
  left: 11.8% !important;
  width: 34.5% !important;
  height: 66% !important;
  overflow: hidden !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__classification {
  top: 0 !important;
  left: 2% !important;
  font-size: 8px !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--visual figure {
  top: 11% !important;
  right: 3% !important;
  left: 2% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  border-color: rgba(73, 55, 34, 0.18) !important;
  background: #e7ddca !important;
  box-shadow: 0 8px 18px rgba(44, 29, 16, 0.13) !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--visual figure img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
}

.ml-library-site .ml-open-book__folio {
  bottom: 6% !important;
  left: 2% !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--copy {
  top: 15% !important;
  left: 54% !important;
  width: 33.5% !important;
  height: 64% !important;
  overflow: hidden !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__meta {
  min-height: 24px !important;
  margin: 0 0 22px !important;
  padding: 0 0 7px !important;
  font-size: 8px !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--copy h2 {
  max-height: 5.25em !important;
  margin: 0 0 16px !important;
  font-size: 24px !important;
  line-height: 1.55 !important;
  -webkit-line-clamp: 3 !important;
}

.ml-library-site .ml-open-book--material[data-title-size="long"] .ml-open-book__page--copy h2 {
  font-size: 21px !important;
  line-height: 1.55 !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__page--copy > p {
  max-height: 5.7em !important;
  margin: 0 0 auto !important;
  font-size: 11px !important;
  line-height: 1.85 !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__reading {
  margin-top: 10px !important;
  font-size: 8px !important;
}

.ml-library-site .ml-open-book--material .ml-open-book__read {
  min-height: 38px !important;
  margin-top: 7px !important;
  font-size: 12px !important;
}

.ml-library-site .ml-premium-reader .ml-library-controls {
  top: auto !important;
  bottom: 202px !important;
  left: 61% !important;
  z-index: 18 !important;
  min-height: 42px;
  padding: 3px 8px !important;
}

.ml-library-site .ml-premium-reader .ml-library-controls button {
  width: 36px !important;
  height: 36px !important;
}

/* Each button owns a generated leather volume, so selection can move physically. */
.ml-library-site .ml-volume-selector {
  right: auto !important;
  bottom: 32px !important;
  left: 61% !important;
  z-index: 14 !important;
  width: min(58vw, 780px) !important;
  height: 160px !important;
  overflow: visible !important;
  transform: translateX(-50%) !important;
}

.ml-library-site .ml-volume-selector__books {
  display: none !important;
}

.ml-library-site .ml-volume-selector::before {
  position: absolute;
  right: -4%;
  bottom: -35px;
  left: -4%;
  z-index: 4;
  height: 76px;
  background: url('./assets/menslab-premium-library/chapter-shelf-v1.webp') center bottom / 100% 100% no-repeat;
  filter: drop-shadow(0 15px 10px rgba(5, 4, 2, 0.42));
  content: '';
  pointer-events: none;
}

.ml-library-site .ml-volume-selector::after {
  position: absolute;
  bottom: -7px;
  left: 50%;
  z-index: 6;
  color: #4f371d;
  content: 'NEW ARRIVALS';
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
  pointer-events: none;
  transform: translateX(-50%);
}

.ml-library-site .ml-volume-selector__grid {
  position: absolute !important;
  inset: 0 4% 22px !important;
  z-index: 5;
  display: grid !important;
  height: auto !important;
  grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
  gap: 2px;
  align-items: end !important;
}

.ml-library-site .ml-volume-selector__book {
  --ml-volume-height: 94%;
  position: relative !important;
  z-index: 1;
  width: 100% !important;
  height: var(--ml-volume-height) !important;
  min-width: 0 !important;
  overflow: visible !important;
  transform: translateY(0) !important;
  transform-origin: 50% 100%;
  transition: filter 220ms ease, transform 260ms cubic-bezier(0.2, 0.75, 0.22, 1) !important;
}

.ml-library-site .ml-volume-selector__book:nth-child(1) { --ml-volume-height: 100%; }
.ml-library-site .ml-volume-selector__book:nth-child(2) { --ml-volume-height: 95%; }
.ml-library-site .ml-volume-selector__book:nth-child(3) { --ml-volume-height: 94%; }
.ml-library-site .ml-volume-selector__book:nth-child(4) { --ml-volume-height: 91%; }
.ml-library-site .ml-volume-selector__book:nth-child(5) { --ml-volume-height: 89%; }
.ml-library-site .ml-volume-selector__book:nth-child(6) { --ml-volume-height: 84%; }
.ml-library-site .ml-volume-selector__book:nth-child(7) { --ml-volume-height: 91%; }
.ml-library-site .ml-volume-selector__book:nth-child(8) { --ml-volume-height: 97%; }
.ml-library-site .ml-volume-selector__book:nth-child(9) { --ml-volume-height: 94%; }
.ml-library-site .ml-volume-selector__book:nth-child(10) { --ml-volume-height: 93%; }

.ml-library-site .ml-volume-selector__book::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: 88% 100%;
  content: '';
  filter: drop-shadow(0 12px 7px rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.ml-library-site .ml-volume-selector__book:nth-child(1)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-01-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(2)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-02-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(3)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-03-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(4)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-04-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(5)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-05-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(6)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-06-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(7)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-07-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(8)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-08-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(9)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-09-v1.webp'); }
.ml-library-site .ml-volume-selector__book:nth-child(10)::before { background-image: url('./assets/menslab-premium-library/interactive-volume-10-v1.webp'); }

.ml-library-site .ml-volume-selector__book::after {
  right: 20% !important;
  bottom: -8px !important;
  left: 20% !important;
  z-index: 3;
}

.ml-library-site .ml-volume-selector__book:hover,
.ml-library-site .ml-volume-selector__book:focus-visible,
.ml-library-site .ml-volume-selector__book.is-selected {
  z-index: 3;
  filter: brightness(1.07) saturate(1.03);
  transform: translateY(-22px) scale(1.035) !important;
}

.ml-library-site .ml-volume-selector__book.is-selected::before {
  filter: drop-shadow(0 18px 11px rgba(0, 0, 0, 0.44)) drop-shadow(0 0 9px rgba(220, 184, 107, 0.32));
}

.ml-library-site .ml-volume-selector__plate {
  top: 33% !important;
  z-index: 3 !important;
  color: #4f361b !important;
  font-size: 7px !important;
  text-shadow: 0 1px rgba(255, 236, 190, 0.55) !important;
}

.ml-library-site .ml-volume-selector__tooltip {
  bottom: calc(100% + 6px) !important;
  width: 184px !important;
  padding: 9px 11px !important;
  border-top-color: #cba55a !important;
  background: rgba(8, 31, 23, 0.95) !important;
  color: #fff7e8 !important;
  box-shadow: 0 12px 24px rgba(5, 3, 2, 0.34) !important;
  backdrop-filter: blur(8px);
}

.ml-library-site .ml-volume-selector__tooltip::after {
  border-top-color: rgba(8, 31, 23, 0.95) !important;
}

.ml-library-site .ml-volume-selector__tooltip em {
  margin-bottom: 3px !important;
  color: #d9b66c !important;
  font-size: 8px !important;
}

.ml-library-site .ml-volume-selector__tooltip strong {
  color: #fff8ea !important;
  font-size: 11px !important;
  line-height: 1.55 !important;
}

.ml-library-site .ml-volume-selector__tooltip {
  display: none !important;
}

.ml-library-site .ml-volume-selector__short-title {
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: 3;
  display: block;
  max-height: 72px;
  overflow: hidden;
  color: rgba(255, 246, 222, 0.94);
  font-family: 'Yu Mincho', 'Hiragino Mincho ProN', serif;
  font-size: 7px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.86);
  transform: translate(-50%, -50%);
  writing-mode: vertical-rl;
  pointer-events: none;
}

.ml-mobile-volume-caption {
  display: none;
}

.ml-library-site .ml-stage-categories--premium {
  height: 52px !important;
}

/* Catalog rows keep the article art legible and use only a restrained book spine. */
@media (min-width: 1100px) {
  .gentlestyle-category-page__layout,
  .gentlestyle-listing-page > .flex {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 300px !important;
    gap: 48px !important;
  }

  .gentlestyle-category-page__layout > .gentlestyle-category-page__main,
  .gentlestyle-listing-page > .flex > :first-child,
  .gentlestyle-category-page__layout > .gentlestyle-sidebar,
  .gentlestyle-listing-page > .flex > .gentlestyle-sidebar {
    width: auto !important;
    max-width: none !important;
  }
}

@media (max-width: 1380px) and (min-width: 781px) {
  .ml-library-site .ml-premium-stage__intro {
    left: 28px !important;
    width: 230px !important;
  }

  .ml-library-site .ml-premium-stage__intro strong {
    font-size: 34px !important;
  }

  .ml-library-site .ml-open-book--material {
    left: 62% !important;
    width: min(60vw, 780px) !important;
  }

  .ml-library-site .ml-premium-reader .ml-library-controls,
  .ml-library-site .ml-volume-selector {
    left: 62% !important;
  }

  .ml-library-site .ml-volume-selector {
    width: min(60vw, 750px) !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__page--copy h2 {
    font-size: 21px !important;
  }

  .ml-library-site .ml-open-book--material[data-title-size="long"] .ml-open-book__page--copy h2 {
    font-size: 18px !important;
  }
}

@media (max-width: 1024px) and (min-width: 781px) {
  .ml-library-site .ml-premium-stage {
    height: 760px !important;
    min-height: 760px !important;
  }

  .ml-library-site .ml-premium-stage__intro {
    top: 24px !important;
  }

  .ml-library-site .ml-open-book--material {
    top: 105px !important;
    left: 50% !important;
    width: min(88vw, 760px) !important;
  }

  .ml-library-site .ml-premium-reader .ml-library-controls {
    bottom: 260px !important;
    left: 50% !important;
  }

  .ml-library-site .ml-volume-selector {
    bottom: 52px !important;
    left: 50% !important;
    width: min(90vw, 760px) !important;
  }
}

@media (max-width: 780px) {
  .gentlestyle-category-filter {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    scroll-snap-type: none !important;
  }

  .gentlestyle-category-filter a {
    min-width: 0 !important;
    min-height: 54px !important;
    padding: 9px 8px !important;
    flex: none !important;
    border-right: 1px solid var(--ml-library-line) !important;
    border-bottom: 1px solid var(--ml-library-line) !important;
    scroll-snap-align: none !important;
  }

  .gentlestyle-category-filter a:nth-child(even),
  .gentlestyle-category-filter a:last-child {
    border-right: 0 !important;
  }

  .gentlestyle-category-filter a:last-child {
    grid-column: 1 / -1;
    border-bottom: 0 !important;
  }

  .gentlestyle-category-filter a span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .ml-library-site .ml-premium-stage {
    height: 830px !important;
    min-height: 830px !important;
    overflow: hidden !important;
  }

  .ml-library-site .ml-premium-stage .ml-library-stage__scene {
    object-position: 50% center !important;
  }

  .ml-library-site .ml-premium-stage__intro {
    top: 20px !important;
    left: 18px !important;
    width: calc(100% - 36px) !important;
  }

  .ml-library-site .ml-premium-stage__intro h1 {
    margin-bottom: 8px !important;
  }

  .ml-library-site .ml-premium-stage__intro strong {
    margin-bottom: 0 !important;
    font-size: 28px !important;
    line-height: 1.45 !important;
  }

  .ml-library-site .ml-volume-selector {
    --ml-mobile-shelf-width: 1010px;
    top: 132px !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    width: 100% !important;
    height: 190px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    transform: none !important;
    scroll-padding-inline: 28px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .ml-library-site .ml-volume-selector::-webkit-scrollbar {
    display: none;
  }

  .ml-library-site .ml-volume-selector::before {
    right: 0;
    bottom: -14px;
    left: 0;
    width: var(--ml-mobile-shelf-width);
    height: 66px;
    background-size: 100% 100%;
  }

  .ml-library-site .ml-volume-selector::after {
    bottom: 10px;
    left: calc(var(--ml-mobile-shelf-width) / 2);
  }

  .ml-library-site .ml-volume-selector__grid {
    position: absolute !important;
    inset: 0 auto 25px 0 !important;
    width: max-content !important;
    height: auto !important;
    display: flex !important;
    gap: 8px !important;
    align-items: flex-end !important;
    padding: 0 28px !important;
  }

  .ml-library-site .ml-volume-selector__book {
    flex: 0 0 88px;
    width: 88px !important;
    min-width: 88px !important;
    max-height: 160px !important;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .ml-library-site .ml-volume-selector__book:hover,
  .ml-library-site .ml-volume-selector__book:focus-visible,
  .ml-library-site .ml-volume-selector__book.is-selected {
    transform: translateY(-13px) scale(1.035) !important;
  }

  .ml-library-site .ml-volume-selector__tooltip {
    display: none !important;
  }

  .ml-library-site .ml-volume-selector__short-title {
    position: absolute;
    top: 47%;
    left: 50%;
    z-index: 3;
    display: block;
    max-height: 72px;
    overflow: hidden;
    color: rgba(255, 246, 222, 0.94);
    font-family: 'Yu Mincho', 'Hiragino Mincho ProN', serif;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    transform: translate(-50%, -50%);
    writing-mode: vertical-rl;
    pointer-events: none;
  }

  .ml-library-site .ml-mobile-volume-caption {
    position: absolute;
    top: 326px;
    right: 18px;
    left: 18px;
    z-index: 15;
    display: grid;
    gap: 3px;
    margin: 0;
    color: #fff7e6;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
  }

  .ml-library-site .ml-mobile-volume-caption span {
    color: #dfc27f;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.1em;
  }

  .ml-library-site .ml-mobile-volume-caption strong {
    display: -webkit-box;
    max-width: 34em;
    margin: 0 auto;
    overflow: hidden;
    font-family: 'Yu Mincho', 'Hiragino Mincho ProN', serif;
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .ml-library-site .ml-open-book--material {
    top: 378px !important;
    left: 50% !important;
    width: min(calc(100% - 20px), 420px) !important;
    aspect-ratio: 3 / 2 !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__page--visual {
    top: 15.2% !important;
    left: 11.8% !important;
    width: 34.5% !important;
    height: 66% !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__classification {
    top: 0 !important;
    left: 2% !important;
    width: auto !important;
    font-size: 7px !important;
    text-align: left !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__page--visual figure {
    top: 13% !important;
    right: 3% !important;
    left: 2% !important;
    width: auto !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__page--copy {
    top: 15% !important;
    left: 54% !important;
    width: 33.5% !important;
    height: 64% !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__meta {
    min-height: 14px !important;
    margin: 0 0 5px !important;
    padding-bottom: 4px !important;
    font-size: 7px !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__page--copy h2,
  .ml-library-site .ml-open-book--material[data-title-size="long"] .ml-open-book__page--copy h2 {
    max-height: 6.6em !important;
    margin-bottom: 4px !important;
    font-size: 11px !important;
    line-height: 1.48 !important;
    overflow-wrap: normal !important;
    word-break: auto-phrase;
    -webkit-line-clamp: 4 !important;
  }

  .ml-library-site .ml-open-book--material .ml-open-book__read {
    min-height: 28px !important;
    margin-top: auto !important;
    font-size: 9px !important;
  }

  .ml-library-site .ml-premium-reader .ml-library-controls {
    top: 646px !important;
    bottom: auto !important;
    left: 50% !important;
  }

  .ml-library-site .ml-mobile-entry-cue {
    top: 718px !important;
    display: flex !important;
  }

}

@media (max-width: 420px) {
  .ml-library-site .ml-premium-stage__intro strong {
    font-size: 26px !important;
  }

  .ml-library-site .ml-open-book--material {
    width: min(calc(100% - 14px), 408px) !important;
  }

}

@media (prefers-reduced-motion: reduce) {
  .ml-library-site .ml-volume-selector__book {
    transition: none !important;
  }
}
