/* KhabarThali 6.37.0 — fixed news media ratios + non-destructive site-logo watermark.
   Deliberately scoped to editorial/news media. Author avatars, team portraits, radio logos,
   e-paper covers and utility artwork are not changed. */

:root{
  --kt-watermark-opacity:.72;
  --kt-watermark-size:20%;
  --kt-watermark-top:auto;
  --kt-watermark-right:12px;
  --kt-watermark-bottom:12px;
  --kt-watermark-left:auto;
  --kt-watermark-tx:0;
  --kt-watermark-ty:0;
}

/* Fixed primary-news media geometry on both desktop and mobile. */
:is(
  .kt618-feature-media,
  .kt618-main-image,
  .kt618-category-image,
  .kt618-must-image,
  .kt618-special-image,
  .kt618-province-image,
  .kt618-archive-lead-image,
  .kt618-archive-item-image,
  .kt-card:not(.kt-card-row) > .kt-card-image,
  .kt627-related-image,
  .kt629-recovery__image
){
  position:relative;
  display:block;
  overflow:hidden;
  aspect-ratio:16/9!important;
  background:#e9edf1;
}

:is(
  .kt618-feature-media,
  .kt618-main-image,
  .kt618-category-image,
  .kt618-must-image,
  .kt618-special-image,
  .kt618-province-image,
  .kt618-archive-lead-image,
  .kt618-archive-item-image,
  .kt-card:not(.kt-card-row) > .kt-card-image,
  .kt627-related-image,
  .kt629-recovery__image
) > img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:none!important;
  max-height:none!important;
  aspect-ratio:16/9!important;
  object-fit:cover!important;
  object-position:center 42%;
}

/* Compact list thumbnails keep one predictable 4:3 crop instead of changing ratio by breakpoint. */
:is(
  .kt618-list-thumb,
  .kt-ranked-image,
  .kt-card-row > .kt-card-image,
  .kt618-archive-item .kt618-archive-item-image
){
  position:relative;
  display:block;
  overflow:hidden;
  aspect-ratio:4/3!important;
  background:#e9edf1;
}

:is(
  .kt618-list-thumb,
  .kt-ranked-image,
  .kt-card-row > .kt-card-image,
  .kt618-archive-item .kt618-archive-item-image
) > img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:none!important;
  max-height:none!important;
  aspect-ratio:4/3!important;
  object-fit:cover!important;
  object-position:center;
}

/* Site-logo watermark. It is a visual overlay; the original Media Library file is never modified. */
:is(
  .kt618-feature-media,
  .kt618-main-image,
  .kt618-category-image,
  .kt618-must-image,
  .kt618-special-image,
  .kt618-province-image,
  .kt618-archive-lead-image,
  .kt-card:not(.kt-card-row) > .kt-card-image,
  .kt627-related-image,
  .kt629-recovery__image
)::after{
  content:"";
  pointer-events:none;
  position:absolute;
  z-index:3;
  top:var(--kt-watermark-top);
  right:var(--kt-watermark-right);
  bottom:var(--kt-watermark-bottom);
  left:var(--kt-watermark-left);
  transform:translate(var(--kt-watermark-tx),var(--kt-watermark-ty));
  width:clamp(72px,var(--kt-watermark-size),170px);
  aspect-ratio:4.6/1;
  border-radius:6px;
  background-color:rgba(255,255,255,.82);
  background-image:var(--kt-watermark-logo,none);
  background-repeat:no-repeat;
  background-position:center;
  background-size:calc(100% - 12px) auto;
  box-shadow:0 2px 10px rgba(3,18,32,.16);
  opacity:var(--kt-watermark-opacity);
}

/* Keep tiny list images uncluttered. */
:is(.kt618-list-thumb,.kt-ranked-image,.kt-card-row > .kt-card-image)::after{display:none!important}

/* Single article featured image keeps a consistent crop too, but caption remains outside the crop. */
.kt-ref-featured-image > img{
  display:block!important;
  width:100%!important;
  aspect-ratio:16/9!important;
  max-height:680px!important;
  object-fit:cover!important;
  object-position:center 42%;
}

/* Desktop fixed sizes: predictable visual rhythm without stretching uploaded source images. */
@media (min-width:1101px){
  .kt618-news-list .kt618-list-thumb{width:132px!important;min-width:132px!important;height:auto!important;min-height:0!important}
  .kt631-desk .kt618-list-thumb{width:132px!important;min-width:132px!important;height:auto!important;min-height:0!important}
  .kt618-archive-item-image{min-height:0!important}
}

/* Mobile: fixed thumbnail width + crop. Main images remain full-width 16:9. */
@media (max-width:1100px){
  :is(.kt618-feature-media,.kt618-main-image,.kt618-category-image,.kt618-must-image,.kt618-special-image,.kt618-province-image){
    width:100%!important;
    max-width:none!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:16/9!important;
  }
  .kt618-news-list .kt618-list-thumb,
  .kt631-desk .kt618-list-thumb{
    width:112px!important;
    min-width:112px!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:4/3!important;
  }
  :is(
    .kt618-feature-media,
    .kt618-main-image,
    .kt618-category-image,
    .kt618-must-image,
    .kt618-special-image,
    .kt618-province-image,
    .kt618-archive-lead-image,
    .kt-card:not(.kt-card-row) > .kt-card-image,
    .kt627-related-image
  )::after{
    width:clamp(66px,22%,120px);
    border-radius:5px;
    background-size:calc(100% - 10px) auto;
  }
}

@media (max-width:430px){
  .kt618-news-list .kt618-list-thumb,
  .kt631-desk .kt618-list-thumb{width:96px!important;min-width:96px!important}
  :is(.kt618-feature-media,.kt618-main-image,.kt618-category-image,.kt618-must-image)::after{
    right:9px;
    bottom:9px;
    width:72px;
  }
}

[data-theme="dark"] :is(
  .kt618-feature-media,.kt618-main-image,.kt618-category-image,.kt618-must-image,
  .kt618-special-image,.kt618-province-image,.kt618-archive-lead-image,
  .kt-card:not(.kt-card-row) > .kt-card-image,.kt627-related-image
)::after{
  background-color:rgba(241,245,249,.84);
  box-shadow:0 2px 12px rgba(0,0,0,.28);
}
