/* =============================================
   Ver.1379 - Work thumbnail source/ratio contract fix
   - Home latest/recommended: representative image (rep_image), portrait 1429x1944.
   - Public work/category/search/my/detail-list thumbnails: cover image, landscape 320x216.
   - Keep Ver.1378 unified VR/JAV/subtitle badge colors.
   - References: MDN aspect-ratio, object-fit, object-position, cascade order.
   ============================================= */
:root{
  --javyun-home-rep-thumb-ratio:1429 / 1944;
  --javyun-cover-thumb-ratio:320 / 216;
}

/* HOME: representative images are vertical cover art. This selector intentionally
   outranks Ver.1377's page-home landscape rule and Ver.1378's generic rule. */
@media (min-width:761px){
  html body .home .home-workgrid > .home-worktile,
  html body.page-home .home .home-workgrid > .home-worktile{
    display:flex !important;
    flex-direction:column !important;
    min-width:0 !important;
    min-height:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    overflow:visible !important;
  }

  html body .home .home-workgrid > .home-worktile > .home-worktile__img,
  html body.page-home .home .home-workgrid > .home-worktile > .home-worktile__img,
  html body.public-dark.page-home .home .home-workgrid > .home-worktile > .home-worktile__img,
  html body .home .home-workgrid > .home-worktile > .home-worktile__img.is-wd-matte-trimmed,
  html body.page-home .home .home-workgrid > .home-worktile > .home-worktile__img.is-wd-matte-trimmed{
    position:relative !important;
    display:block !important;
    width:100% !important;
    inline-size:100% !important;
    height:auto !important;
    block-size:auto !important;
    aspect-ratio:var(--javyun-home-rep-thumb-ratio) !important;
    min-height:0 !important;
    max-height:none !important;
    padding:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    overflow:hidden !important;
    line-height:0 !important;
  }

  html body .home .home-workgrid > .home-worktile > .home-worktile__img > img,
  html body.page-home .home .home-workgrid > .home-worktile > .home-worktile__img > img,
  html body.public-dark.page-home .home .home-workgrid > .home-worktile > .home-worktile__img > img,
  html body .home .home-workgrid > .home-worktile > .home-worktile__img.is-wd-matte-trimmed > img,
  html body.page-home .home .home-workgrid > .home-worktile > .home-worktile__img.is-wd-matte-trimmed > img{
    display:block !important;
    position:static !important;
    inset:auto !important;
    width:100% !important;
    inline-size:100% !important;
    height:100% !important;
    block-size:100% !important;
    min-width:0 !important;
    min-height:0 !important;
    max-width:100% !important;
    max-height:100% !important;
    aspect-ratio:auto !important;
    object-fit:cover !important;
    object-position:center top !important;
    transform:none !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
  }
}

@media (min-width:1101px){
  html body .home .home-card--latest .home-workgrid,
  html body .home .home-card--recommended .home-workgrid,
  html body.page-home .home .home-card--latest .home-workgrid,
  html body.page-home .home .home-card--recommended .home-workgrid{
    grid-template-columns:repeat(6, minmax(0, 1fr)) !important;
    gap:24px 20px !important;
  }
}

@media (min-width:761px) and (max-width:1100px){
  html body .home .home-card--latest .home-workgrid,
  html body .home .home-card--recommended .home-workgrid,
  html body.page-home .home .home-card--latest .home-workgrid,
  html body.page-home .home .home-card--recommended .home-workgrid{
    grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
    gap:22px 16px !important;
  }
}

/* LIST-LIKE WORK THUMBNAILS: category/search/my/detail-side lists use cover images. */
html body :is(
  .work-list-page .works-category-grid .work-thumb,
  .maker-detail-page .works-category-grid .work-thumb,
  .search-page .works-grid.search-results-grid .work-thumb,
  .my-grid.works .my-thumb,
  .actor-detail-page .actor-film-thumb,
  .wd-best-thumb,
  .wd-sim-thumb,
  .wd-related-thumb
){
  position:relative !important;
  display:block !important;
  width:100% !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  aspect-ratio:var(--javyun-cover-thumb-ratio) !important;
  overflow:hidden !important;
  line-height:0 !important;
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
}

html body :is(
  .work-list-page .works-category-grid .work-thumb > img,
  .work-list-page .works-category-grid .work-thumb > .work-cover,
  .maker-detail-page .works-category-grid .work-thumb > img,
  .maker-detail-page .works-category-grid .work-thumb > .work-cover,
  .search-page .works-grid.search-results-grid .work-thumb > img,
  .search-page .works-grid.search-results-grid .work-thumb > .work-cover,
  .my-grid.works .my-thumb > img,
  .actor-detail-page .actor-film-thumb > img,
  .wd-best-thumb > img,
  .wd-sim-thumb > img,
  .wd-related-thumb > img
){
  display:block !important;
  width:100% !important;
  height:100% !important;
  max-width:100% !important;
  max-height:100% !important;
  aspect-ratio:auto !important;
  object-fit:cover !important;
  object-position:center center !important;
  transform:none !important;
  position:static !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}

/* Category/maker desktop list returns to cover-list density. */
:is(.work-list-page, .maker-detail-page) .works-grid.works-category-grid{
  grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
  gap:24px 20px !important;
}
@media (max-width:1200px){
  :is(.work-list-page, .maker-detail-page) .works-grid.works-category-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (max-width:1080px){
  :is(.work-list-page, .maker-detail-page) .works-grid.works-category-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width:900px){
  :is(.work-list-page, .maker-detail-page) .works-grid.works-category-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    gap:22px 14px !important;
  }
}
@media (max-width:760px){
  :is(.work-list-page, .maker-detail-page) .works-grid.works-category-grid{
    grid-template-columns:1fr !important;
    gap:20px !important;
  }
}
