/**
 * @file
 * Journal shelf information-card carousel.
 */

.journal-shelf-block {
  --journal-shelf-accent: #234e70;
  --journal-shelf-surface: #fff;
  --journal-shelf-text: #111;
  --journal-shelf-border: #000;
  --journal-shelf-content-width: 1308px;
  --journal-shelf-page-gutter: 48px;
  --journal-shelf-gap: 24px;

  width: min(1720px, calc(100vw - var(--journal-shelf-page-gutter)));
  margin-left: 50%;
  padding: 48px 0 64px;
  overflow: hidden;
  color: var(--journal-shelf-text);
  background: var(--journal-shelf-surface);
  box-shadow: 0 0 0 100vmax var(--journal-shelf-surface);
  clip-path: inset(0 -100vmax);
  transform: translateX(-50%);
}

.journal-shelf-block__inner {
  width: min(100%, var(--journal-shelf-content-width));
  margin: 0 auto;
}

.journal-shelf-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.journal-shelf-block__title {
  margin: 0;
  color: var(--journal-shelf-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: pretty;
}

.journal-shelf-block__all-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  color: var(--journal-shelf-accent);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.journal-shelf-block__all-link::after {
  width: 8px;
  height: 8px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

.journal-shelf-block__all-link:hover {
  color: var(--journal-shelf-text);
  text-decoration: underline;
}

.journal-shelf-block__all-link:focus-visible {
  outline: 2px solid var(--journal-shelf-accent);
  outline-offset: 3px;
}

.journal-shelf-block__carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 16px;
}

.journal-shelf-block__viewport {
  min-width: 0;
  overflow: hidden;
}

.journal-shelf-block .view-content.row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--journal-shelf-gap);
  width: 100%;
  margin: 0;
  padding: 8px 0 16px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

.journal-shelf-block .view-content.row::-webkit-scrollbar {
  display: none;
}

.journal-shelf-block .views-row {
  width: auto;
  max-width: none;
  flex: 0 0 calc((100% - (var(--journal-shelf-gap) * 3)) / 4);
  padding: 0;
  scroll-snap-align: start;
}

.journal-shelf-card {
  display: grid;
  width: 100%;
  height: 220px;
  box-sizing: border-box;
  grid-template-columns: 42% minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--journal-shelf-border);
  border-radius: 0;
  background: #fff;
  transition:
    box-shadow 160ms ease,
    transform 160ms ease;
}

.journal-shelf-card:hover,
.journal-shelf-card:focus-within {
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.16);
  transform: translateY(-8px);
}

.journal-shelf-card__cover-link {
  display: block;
  width: 100%;
  height: 218px;
}

.journal-shelf-card__cover-link:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--journal-shelf-accent);
  outline-offset: -3px;
}

.journal-shelf-card__cover {
  display: block;
  width: 100%;
  height: 218px;
  max-width: none;
  box-sizing: border-box;
  border-right: 1px solid var(--journal-shelf-border);
  object-fit: cover;
  background: #fff;
}

.journal-shelf-card__info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.journal-shelf-card__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--journal-shelf-text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.journal-shelf-card__pdf-link,
.journal-shelf-card__pdf-text {
  display: block;
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--journal-shelf-border);
  color: var(--journal-shelf-text);
  font-size: 0.82rem;
  line-height: 1.3;
  text-decoration: none;
}

.journal-shelf-card__description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.journal-shelf-card__action {
  display: block;
  margin-top: 7px;
  color: var(--journal-shelf-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.journal-shelf-card__pdf-link:hover .journal-shelf-card__description {
  text-decoration: underline;
}

.journal-shelf-card__pdf-link:focus-visible {
  outline: 2px solid var(--journal-shelf-accent);
  outline-offset: 3px;
}

.journal-shelf-block__arrow {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--journal-shelf-border);
  border-radius: 0;
  color: var(--journal-shelf-text);
  background: #fff;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.journal-shelf-block__arrow span {
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.journal-shelf-block__arrow--previous span {
  transform: translateX(2px) rotate(-135deg);
}

.journal-shelf-block__arrow--next span {
  transform: translateX(-2px) rotate(45deg);
}

.journal-shelf-block__arrow:hover:not(:disabled) {
  color: #fff;
  background: var(--journal-shelf-accent);
  transform: translateY(-2px);
}

.journal-shelf-block__arrow:focus-visible {
  outline: 2px solid var(--journal-shelf-accent);
  outline-offset: 3px;
}

.journal-shelf-block__arrow:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

@media (max-width: 1199.98px) {
  .journal-shelf-block .views-row {
    flex-basis: calc((100% - var(--journal-shelf-gap)) / 2);
  }
}

@media (max-width: 767.98px) {
  .journal-shelf-block {
    --journal-shelf-page-gutter: 32px;
    --journal-shelf-gap: 16px;

    padding: 40px 0 52px;
  }

  .journal-shelf-block__header {
    align-items: flex-end;
  }

  .journal-shelf-block__carousel {
    grid-template-columns: minmax(0, 1fr) 44px 44px minmax(0, 1fr);
    gap: 12px;
  }

  .journal-shelf-block__viewport {
    grid-row: 1;
    grid-column: 1 / -1;
    width: min(100%, 280px);
    justify-self: center;
  }

  .journal-shelf-block__arrow {
    grid-row: 2;
    margin-top: 8px;
  }

  .journal-shelf-block__arrow--previous {
    grid-column: 2;
  }

  .journal-shelf-block__arrow--next {
    grid-column: 3;
  }

  .journal-shelf-block .views-row {
    width: 280px;
    flex: 0 0 280px;
  }

  .journal-shelf-block .view-content.row {
    padding: 8px 0 16px;
  }

  .journal-shelf-card {
    width: 280px;
    height: 520px;
    grid-template-columns: 1fr;
    grid-template-rows: 360px 158px;
  }

  .journal-shelf-card__cover-link,
  .journal-shelf-card__cover {
    width: 100%;
    height: 360px;
  }

  .journal-shelf-card__cover {
    border-right: 0;
    border-bottom: 1px solid var(--journal-shelf-border);
    object-fit: contain;
  }

  .journal-shelf-card__info {
    height: 158px;
    box-sizing: border-box;
    padding: 16px;
    overflow: hidden;
  }

  .journal-shelf-card__title {
    font-size: 1rem;
    -webkit-line-clamp: 2;
  }

  .journal-shelf-card__pdf-link,
  .journal-shelf-card__pdf-text {
    padding-top: 10px;
    font-size: 0.78rem;
  }

  .journal-shelf-card__description {
    -webkit-line-clamp: 1;
  }

  .journal-shelf-card__action {
    margin-top: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .journal-shelf-block .view-content.row {
    scroll-behavior: auto;
  }

  .journal-shelf-card,
  .journal-shelf-block__arrow {
    transition: none;
  }
}
