/* CatRM Cats plugin */

.catrm-cats-list,
.catrm-cats-list *,
.catrm-cats-grid,
.catrm-cats-grid *,
.catrm-cat-detail,
.catrm-cat-detail * {
  box-sizing: border-box;
}

/* Cat list */

.catrm-cats-list {
  display: block;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.catrm-cats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px;
}

.catrm-cat-card {
  display: block;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: #ffffff;
  border-radius: 4px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.catrm-cat-card[hidden] {
  display: none;
}

.catrm-cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.catrm-cat-card:focus-visible {
  outline: 3px solid #169b68;
  outline-offset: 3px;
}

.catrm-cat-card .catrm-cat-image {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 4 / 3;
  object-fit: cover !important;
  object-position: center;
}

.catrm-cat-card .catrm-cat-name {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
}

.catrm-cat-image-placeholder {
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: #777777;
  background: #eeeeee;
}

.catrm-cat-footer {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 12px 16px;
  background: #ffffff;
}

/* Load more button */

.catrm-load-more-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  margin: -8px auto 56px;
  padding: 0 24px;
}

.catrm-load-more-wrapper[hidden] {
  display: none;
}

.catrm-load-more-button {
  min-width: 210px;
  padding: 13px 24px;
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  background: #169b68;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}

.catrm-load-more-button:hover {
  background: #12845a;
  transform: translateY(-1px);
}

.catrm-load-more-button:focus-visible {
  outline: 3px solid #169b68;
  outline-offset: 3px;
}

/* Cat detail */

.catrm-cat-detail {
  width: 100%;
  max-width: 860px;
  margin: 32px auto 64px;
  padding: 0 24px;
  scroll-margin-top: 96px;
  text-align: left;
}

.catrm-back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: #169b68;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.catrm-back-link:hover {
  text-decoration: underline;
}

.catrm-back-link:focus-visible {
  outline: 3px solid #169b68;
  outline-offset: 3px;
}

.catrm-detail-title {
  margin: 0 0 24px;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

/* Gallery */

.catrm-detail-gallery {
  width: 100%;
  max-width: 780px;
  margin: 0 auto 32px;
}

.catrm-gallery-main {
  width: 100%;
  overflow: hidden;
  background: #eeeeee;
  border-radius: 4px;
}

.catrm-gallery-main-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 440px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Thumbnails */

.catrm-gallery-thumbnails {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin: 12px 0 0;
}

.catrm-detail-gallery
  .catrm-gallery-thumbnails
  .catrm-gallery-thumbnail {
  flex: 0 0 calc((100% - 48px) / 5);
  width: calc((100% - 48px) / 5);
  min-width: 0;
  height: 94px;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  appearance: none;
  background: transparent !important;
  border: 2px solid transparent;
  border-radius: 4px !important;
  cursor: pointer;
  opacity: 0.75;
  transition:
    opacity 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.catrm-detail-gallery
  .catrm-gallery-thumbnails
  .catrm-gallery-thumbnail:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.catrm-detail-gallery
  .catrm-gallery-thumbnails
  .catrm-gallery-thumbnail.is-active {
  border-color: #169b68;
  opacity: 1;
}

.catrm-detail-gallery
  .catrm-gallery-thumbnails
  .catrm-gallery-thumbnail:focus-visible {
  outline: 2px solid #169b68;
  outline-offset: 2px;
  opacity: 1;
}

.catrm-detail-gallery
  .catrm-gallery-thumbnails
  .catrm-gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  object-fit: cover;
  border-radius: 0 !important;
}

/* Cat information */

.catrm-detail-info {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  color: #333333;
  font-size: 16px;
  line-height: 1.75;
}

.catrm-detail-info p {
  margin: 0 0 12px;
}

.catrm-detail-info strong {
  color: #1f1f1f;
  font-weight: 600;
}

.catrm-public-description {
  margin-top: 24px;
}

.catrm-public-description p {
  margin: 0 0 18px;
}

/* Previous and next cat */

.catrm-cat-navigation-wrapper {
  display: block;
}

.catrm-cat-navigation {
  position: fixed;
  top: 50%;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  height: 68px;
  overflow: hidden;
  color: #1f1f1f;
  text-decoration: none;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  transform: translateY(-50%);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.catrm-cat-navigation--previous {
  left: 0;
}

.catrm-cat-navigation--next {
  right: 0;
}

.catrm-cat-navigation:hover {
  color: #1f1f1f;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
}

.catrm-cat-navigation--previous:hover {
  transform: translateY(-50%) translateX(2px);
}

.catrm-cat-navigation--next:hover {
  transform: translateY(-50%) translateX(-2px);
}

.catrm-cat-navigation:focus-visible {
  outline: 3px solid #169b68;
  outline-offset: 3px;
}

.catrm-cat-navigation-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  color: #ffffff;
  background: #169b68;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.catrm-cat-navigation-thumbnail {
  display: block;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  object-fit: cover;
}

.catrm-cat-navigation-thumbnail--placeholder {
  display: grid;
  place-items: center;
  background: #eeeeee;
  font-size: 22px;
}

.catrm-cat-navigation-name {
  display: none;
}

/* Medium screens */

@media (max-width: 1100px) {
  .catrm-cats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1000px) {
  .catrm-cat-navigation-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 680px;
    margin: 32px auto 0;
  }

  .catrm-cat-navigation {
    position: static;
    top: auto;
    flex: 1 1 0;
    max-width: 320px;
    height: 58px;
    border: 1px solid #e5e7eb;
    box-shadow: none;
    transform: none;
  }

  .catrm-cat-navigation--previous:hover,
  .catrm-cat-navigation--next:hover {
    transform: translateY(-1px);
  }

  .catrm-cat-navigation--next:first-child {
    margin-left: auto;
  }

  .catrm-cat-navigation-arrow {
    flex-basis: 34px;
    width: 34px;
  }

  .catrm-cat-navigation-thumbnail {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }

  .catrm-cat-navigation-name {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    padding: 0 12px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .catrm-cat-navigation--next .catrm-cat-navigation-name {
    justify-content: flex-end;
    text-align: right;
  }
}

@media (max-width: 800px) {
  .catrm-cats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

/* Tablet and phone */

@media (max-width: 700px) {
  .catrm-cat-detail {
    margin-top: 24px;
    padding: 0 16px;
  }

  .catrm-detail-title {
    margin-bottom: 20px;
    font-size: 30px;
  }

  .catrm-gallery-main-image {
    max-height: none;
    aspect-ratio: 4 / 3;
  }

  .catrm-gallery-thumbnails {
    gap: 8px;
  }

  .catrm-detail-gallery
    .catrm-gallery-thumbnails
    .catrm-gallery-thumbnail {
    flex: 0 0 calc((100% - 16px) / 3);
    width: calc((100% - 16px) / 3);
    max-width: calc((100% - 16px) / 3);
    height: 88px;
  }

  .catrm-detail-info {
    font-size: 16px;
  }
}

/* Small phone */

@media (max-width: 520px) {
  .catrm-cats-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 28px auto;
    padding: 0 16px;
  }

  .catrm-load-more-wrapper {
    margin-bottom: 40px;
    padding: 0 16px;
  }

  .catrm-load-more-button {
    width: 100%;
  }

  .catrm-cat-detail {
    margin-bottom: 48px;
  }

  .catrm-back-link {
    margin-bottom: 14px;
  }

  .catrm-detail-title {
    font-size: 28px;
  }

  .catrm-detail-gallery
    .catrm-gallery-thumbnails
    .catrm-gallery-thumbnail {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    max-width: calc((100% - 8px) / 2);
    height: 80px;
  }

  .catrm-cat-navigation-wrapper {
    flex-direction: column;
  }

  .catrm-cat-navigation {
    width: 100%;
    max-width: none;
  }

  .catrm-cat-navigation--next:first-child {
    margin-left: 0;
  }
}
