/* category-news — .tpl-category-news 아래로 작성 */

.tpl-category-news {
  max-width: none;
  margin: 0;
  padding-top: calc(var(--thesmc-header-height, 72px) + clamp(36px, calc(24.35px + 3.107 * var(--wp--custom--vwc)), 84px));
}

/* ---------- HERO — Works 목록 히어로(category-works.css)와 같은 타이포 (시안 .ir-hero) ---------- */
.tpl-category-news .news-hero {
  padding-bottom: clamp(30px, calc(24.175px + 1.553 * var(--wp--custom--vwc)), 54px);
}

.tpl-category-news .news-hero__title {
  margin: 0;
  font-size: clamp(38px, calc(6.8 * var(--wp--custom--vwc)), 112px);
  text-wrap: balance;
}

/* ---------- CATEGORY TABS — 항목 목록 블록(카테고리). News 하위만 · 순서는 inc/blocks.php, 첫 화면 기본 탭은 inc/news.php.
   모양 · 밑줄 움직임은 수상작 연도 탭(taxonomy-badge.css .yfilter)과 같고 간격만 시안 .ir-tabs 값 ---------- */
.tpl-category-news .nfilter {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, calc(3 * var(--wp--custom--vwc)), 40px);
  margin: 0;
  padding: clamp(6px, calc(4.058px + 0.518 * var(--wp--custom--vwc)), 14px) 0 0;
  list-style: none;
}

.tpl-category-news .nfilter a {
  position: relative;
  display: block;
  padding: 4px 1px;
  font-weight: 500;
  font-size: clamp(15px, calc(1.5 * var(--wp--custom--vwc)), 18px);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--wp--preset--color--line);
  transition: color var(--thesmc-dur) var(--thesmc-ease);
}

.tpl-category-news .nfilter a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--wp--preset--color--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--thesmc-ease);
}

.tpl-category-news .nfilter a:hover,
.tpl-category-news .nfilter .current-cat > a {
  color: var(--wp--preset--color--ink);
}

.tpl-category-news .nfilter .current-cat > a::after {
  transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  .tpl-category-news .nfilter a,
  .tpl-category-news .nfilter a::after {
    transition: none;
  }
}

/* ---------- LIST — 시안 .ir-list. 쿼리 반복문(.news-list) > 글 템플릿(.nlist)을 inc/blocks.php가 연도별 묶음으로 다시 짠다
   ul.nlist > li.nlist__year > (p.nlist__label + ul.nlist__items > li > .news-item > (.news-item__text + .news-item__thumb))
   모바일은 연도 아래로 글이 쌓이고(썸네일이 글자 위), 768px부터 왼쪽 연도(스크롤해도 묶음 끝까지 따라옴) · 오른쪽 글(글자 · 썸네일) 2단.
   대표 이미지가 없는 글은 블록이 아무것도 내보내지 않아 글자만 남는다 ---------- */
.tpl-category-news .news-list {
  padding: clamp(8px, calc(5.087px + 0.777 * var(--wp--custom--vwc)), 20px) 0
    clamp(38px, calc(31.495px + 1.735 * var(--wp--custom--vwc)), 64.8px); /* 아래 여백은 Works 목록과 같은 이유(View More가 없는 마지막 쪽)로 여기에 둔다 */
}

.tpl-category-news .nlist,
.tpl-category-news .nlist__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tpl-category-news .nlist__year {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tpl-category-news .nlist__year + .nlist__year {
  border-top: 1px solid var(--wp--preset--color--line);
}

.tpl-category-news .nlist__label {
  margin: 0;
  padding-top: clamp(26px, calc(23.398px + 0.694 * var(--wp--custom--vwc)), 36.72px);
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 43px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--wp--preset--color--line);
}

.tpl-category-news .nlist__items {
  flex: 1 1 auto;
  min-width: 0;
}

/* 같은 해 글 사이의 선 — 연도 사이는 위의 border-top이 그어서 첫 글은 뺀다 */
.tpl-category-news .nlist__items > li {
  position: relative;
}

.tpl-category-news .nlist__items > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--wp--preset--color--line);
}

.tpl-category-news .news-item {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: var(--wp--preset--spacing--sm);
  padding: clamp(38px, 5.2vh, 60px) 0;
}

.tpl-category-news .news-item__text {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vh, 16px);
  min-width: 0;
}

.tpl-category-news .news-item__text > * {
  margin: 0;
}

.tpl-category-news .news-item__cat,
.tpl-category-news .news-item__date {
  line-height: 1.7;
}

/* 썸네일 — 비율(16:10)은 블록 설정, 폭만 여기서. 모바일은 Works 카드처럼 목록 폭에 꽉 차게 */
.tpl-category-news .news-item__thumb {
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.tpl-category-news .news-item__thumb img {
  display: block;
}

/* 썸네일 fade-in — 숨김은 category-news.js가 .is-motion을 붙였을 때만(JS가 없거나 움직임 줄이기면 처음부터 보인다).
   전환은 나타날 때만 — 숨김 쪽에 두면 .is-motion이 붙는 순간 이미 보이던 썸네일이 서서히 사라진다 */
.tpl-category-news .nlist.is-motion .news-item__thumb {
  opacity: 0;
}

.tpl-category-news .nlist.is-motion .news-item__thumb.is-in {
  opacity: 1;
  transition: opacity 0.8s var(--thesmc-ease) var(--news-delay, 0s);
}

.tpl-category-news .news-item__title {
  font-size: clamp(18px, calc(1.8 * var(--wp--custom--vwc)), 24px);
  text-wrap: pretty;
}

/* 항목 전체가 제목 링크 — 링크의 ::after를 항목(li) 크기로 펼친다. 사이의 그룹 · 제목은 위치 기준이 되지 않게 둔다.
   밑줄은 글자를 따라 그리는 배경으로(여러 줄 제목도 줄마다), 항목에 올리면 왼쪽부터 그어진다 */
.tpl-category-news .news-item__title a {
  display: inline; /* 코어 제목 블록의 inline-block이면 여러 줄 제목도 상자 하나라 밑줄이 맨 아래 한 줄만 그어진다 */
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.35s var(--thesmc-ease);
}

.tpl-category-news .news-item__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1; /* 썸네일(코어가 position: relative를 준다)보다 위 — 썸네일을 눌러도 이동하게 */
}

.tpl-category-news .nlist__items > li:hover .news-item__title a,
.tpl-category-news .news-item__title a:focus-visible {
  background-size: 100% 1px;
}

@media (min-width: 768px) {
  .tpl-category-news .nlist__year {
    flex-direction: row;
    align-items: flex-start;
    gap: clamp(32px, calc(8 * var(--wp--custom--vwc)), 140px);
  }

  .tpl-category-news .nlist__label {
    position: sticky;
    top: calc(var(--thesmc-header-height, 72px) + 24px);
    flex: 0 0 auto;
    width: clamp(96px, calc(12 * var(--wp--custom--vwc)), 180px);
  }

  /* 글자는 왼쪽 · 썸네일은 오른쪽(시안 .ir-link) */
  .tpl-category-news .news-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: clamp(20px, calc(4 * var(--wp--custom--vwc)), 56px);
  }

  /* 글자는 연도 칸에서 한 번 더 들여 쓰고, 같은 해 글 사이 선도 글자 시작점부터 */
  .tpl-category-news .news-item__text {
    flex: 1 1 auto;
    margin-left: clamp(40px, calc(12 * var(--wp--custom--vwc)), 200px);
  }

  .tpl-category-news .news-item__thumb {
    flex: 0 0 auto;
    width: clamp(180px, calc(20 * var(--wp--custom--vwc)), 257px);
  }

  .tpl-category-news .nlist__items > li + li::before {
    left: clamp(40px, calc(12 * var(--wp--custom--vwc)), 200px);
  }
}

/* ---------- VIEW MORE — Works 목록 View More(parts/works-grid.css)와 같은 모양. 동작은 category-news.js ---------- */
.tpl-category-news .wrk-more {
  margin: 0;
  padding-top: clamp(48px, calc(41.301px + 1.786 * var(--wp--custom--vwc)), 75.6px);
}

.tpl-category-news .wrk-more .wp-block-query-pagination-next {
  display: inline-flex;
  align-items: center;
  padding: 15px 26px;
  border: 1px solid var(--wp--preset--color--ink);
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--wp--preset--color--ink);
  transition:
    background var(--thesmc-dur) ease,
    color var(--thesmc-dur) ease,
    opacity var(--thesmc-dur) ease;
}

.tpl-category-news .wrk-more .wp-block-query-pagination-next:hover {
  background: var(--wp--preset--color--ink);
  color: var(--wp--preset--color--white);
}

.tpl-category-news .wrk-more .wp-block-query-pagination-next.is-loading,
.tpl-category-news .wrk-more .wp-block-query-pagination-next.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .tpl-category-news .news-item__title a,
  .tpl-category-news .wrk-more .wp-block-query-pagination-next {
    transition: none;
  }
}
