/* Shared presentation for release rails and the character library. */
[data-catalog-home-only][hidden] { display: none !important; }
.category-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 var(--catalog-gutter) 8px;
  color: #b1b1bb;
  font: 600 16.5px/1.4 var(--c-sans);
  text-decoration: none;
}
.category-back:hover { color: #f65265; }
.category-back:focus-visible { outline: 2px solid #f65265; outline-offset: 2px; }
.catalog-section {
  --catalog-columns: 3;
  --catalog-gap: 10px;
  --catalog-gutter: 16px;
  --catalog-radius: 10px;
  min-width: 0;
}
.catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--catalog-gutter) 16px;
}
.catalog-heading > div:first-child { min-width: 0; }
/* Section headings follow the compact catalogue scale: a small grey lead-in over an 18px semibold title. */
.catalog-eyebrow { margin: 0 0 4px; color: #8f8f99; font: 500 13.5px/1.4 var(--c-sans); }
.catalog-title { margin: 0; color: #fafafa; font: 600 18px/1.3 var(--c-sans); letter-spacing: -.01em; word-break: keep-all; }
/* Korean headings break between words, never inside one ("연락했 / 을까"). */
.rail-label { word-break: keep-all; }
.catalog-actions { display: flex; gap: 4px; flex: none; }
.catalog-actions button, .catalog-sort, .home-recent-all {
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #ffffff20;
  border-radius: 8px;
  background: transparent;
  color: #c6c6cd;
  font: 600 15.5px/1 var(--c-sans);
  cursor: pointer;
}
.catalog-actions button { width: 32px; padding: 0; }
.catalog-actions i { font-size: 20px; }
.catalog-sort, .home-recent-all { flex: none; white-space: nowrap; text-decoration: none; }
.catalog-sort i, .home-recent-all i { color: #f65265; }
.catalog-actions button:disabled { opacity: .28; cursor: default; }
.nox-release-rail, .character-library {
  display: grid;
  gap: 24px var(--catalog-gap);
  padding: 2px var(--catalog-gutter) 8px;
  box-sizing: border-box;
  min-width: 0;
}
.nox-release-rail {
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--catalog-columns) - 1) * var(--catalog-gap)) / var(--catalog-columns));
  align-items: start;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding-inline: var(--catalog-gutter);
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  touch-action: auto;
  scrollbar-width: none;
  cursor: grab;
}
.nox-release-rail::-webkit-scrollbar { display: none; }
.nox-release-rail.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.character-library {
  grid-template-columns: repeat(var(--catalog-columns), minmax(0, 1fr));
  align-items: start;
}
.nox-release-card, .character-grid-card {
  appearance: none;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}
.character-grid-card[hidden], .nox-release-card[hidden], .character-grid-card.is-paged-out { display: none; }
/* Infinite scroll loader shared by the story library and the character roster. */
.catalog-more[hidden] { display: none; }
.catalog-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 26px 0 8px;
  color: #8e8e97;
  font: 500 15.5px/1.4 var(--c-sans);
}
.catalog-more-spinner {
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 2px solid #ffffff24;
  border-top-color: #f04a5c;
  border-radius: 50%;
  animation: catalog-more-spin .8s linear infinite;
}
@keyframes catalog-more-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .catalog-more-spinner { animation: none; } }
.nox-release-cover, .character-grid-cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  box-sizing: border-box;
  margin-bottom: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #ffffff24;
  border-radius: var(--catalog-radius);
  background: #1b1b20;
}
.nox-release-cover > img, .character-grid-cover > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  -webkit-user-drag: none;
}
/* Under every thumbnail, as in character-chat catalogues: a one-line bold title, the one-line pitch, then the
   studio byline with the view count (setupCardStats in crack-parity.js). Every line is strictly one line with an
   ellipsis, so no card reserves blank lines for text it does not have.
   Both card kinds hold the title in their strong and the pitch in the element after it (a small or span in release
   cards, a span in library cards). The genre meta line stays on the detail page. */
.nox-release-copy { display: grid; gap: 2px; min-width: 0; }
.nox-release-cover + .nox-release-copy { margin-top: 10px; }
.nox-release-copy > em, .character-grid-card > small { display: none; }
.nox-release-copy > strong,
.character-grid-card > strong {
  display: block;
  overflow: hidden;
  color: #f4f5f8;
  font: 700 15px/1.4 var(--c-sans);
  letter-spacing: -.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.character-grid-cover + strong { margin-top: 10px; }
.nox-release-copy > small, .nox-release-copy > span,
.character-grid-card > strong + span {
  display: block;
  overflow: hidden;
  color: #c3c7d1;
  font: 400 13px/1.45 var(--c-sans);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.character-grid-card > strong + span { margin-top: 2px; }
.nox-release-copy > .card-byline,
.character-grid-card > .card-byline {
  display: block;
  overflow: hidden;
  color: #8f8f99;
  font: 500 12px/1.4 var(--c-sans);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.character-grid-card > .card-byline { margin-top: 2px; }
.card-byline-studio { color: #f0788a; font-weight: 600; }
@media (hover: hover) {
  .nox-release-card:hover .nox-release-copy > strong,
  .character-grid-card:hover > strong { color: #fff; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
}
@media (max-width: 767px) {
  .nox-release-copy > strong, .character-grid-card > strong { font-size: 14px; }
  .nox-release-copy > small, .nox-release-copy > span, .character-grid-card > strong + span { font-size: 12.5px; }
  .nox-release-copy > .card-byline, .character-grid-card > .card-byline { font-size: 11.5px; }
}
.catalog-actions button:focus-visible, .catalog-sort:focus-visible,
.nox-release-card:focus-visible, .character-grid-card:focus-visible, .nox-release-rail:focus-visible {
  outline: 2px solid #f65265;
  outline-offset: 2px;
  border-radius: 8px;
}
@media (hover: hover) {
  .catalog-actions button:hover:not(:disabled), .catalog-sort:hover { background: #f6526517; border-color: #f6526580; }
  .nox-release-card:hover .nox-release-cover, .character-grid-card:hover .character-grid-cover { border-color: #f6526580; }
}
/* Phones stay at two columns. Tablets (600-767px) step up to three, because two columns rendered
   their 2:3 covers larger than either the phone or the desktop grid. */
@media (max-width: 599px) {
  .catalog-section { --catalog-columns: 2; --catalog-gap: 10px; }
}
@media (min-width: 600px) and (max-width: 767px) {
  .catalog-section { --catalog-columns: 3; --catalog-gap: 10px; }
}
@media (min-width: 768px) {
  /* Desktop thumbnails are a fixed 165px wide 2:3 poster with 12px corners and 8px gaps; rails scroll past the
     column edge so the next poster peeks in. */
  .catalog-section { --catalog-columns: 5; --catalog-gap: 8px; --catalog-gutter: 0px; --catalog-radius: 12px; }
  .nox-release-rail { grid-auto-columns: 165px; }
}

/* On every story thumbnail (setupCardStats in crack-parity.js): an ORIGINAL tag in the top-left corner and the
   comment and introduction-image counts in the top-right corner. The English covers paint their title lettering in
   the lower third, so both stay along the top edge, clear of the lettering.
   Both sit flush with the top edge and share one row height (--thumb-badge-height) so their text sits on the same
   line: the tag is a strip fading toward the middle, and the two counts share one dark corner tab. */
.nox-release-cover, .character-grid-cover { --thumb-badge-height: 20px; }
.thumb-original,
.nox-release-cover > .thumb-stat-row,
.character-grid-cover > .thumb-stat-row {
  position: absolute;
  z-index: 7;
  top: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--thumb-badge-height);
  color: #fff;
  pointer-events: none;
}
.thumb-original {
  left: 0;
  padding: 0 14px 0 8px;
  background: linear-gradient(90deg, #000 62%, #0000);
  font: 800 10.5px/1 var(--c-sans);
  letter-spacing: .06em;
}
.thumb-original::first-letter { color: #ff5268; }
.nox-release-cover > .thumb-stat-row,
.character-grid-cover > .thumb-stat-row {
  right: 0;
  gap: 7px;
  padding: 0 8px;
  border-bottom-left-radius: 8px;
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.card-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font: 500 11.5px/1 var(--c-sans);
}
.card-stat i { font-size: 12px; line-height: 1; }
.card-stat b { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 479px) {
  .nox-release-cover, .character-grid-cover { --thumb-badge-height: 18px; }
  .thumb-original { padding: 0 12px 0 6px; font-size: 9.5px; }
  .nox-release-cover > .thumb-stat-row,
  .character-grid-cover > .thumb-stat-row { gap: 5px; padding: 0 6px; border-bottom-left-radius: 7px; }
  .card-stat { font-size: 10.5px; }
  .card-stat i { font-size: 11px; }
}

/* 홈 중복 정리(index.js curateHomeShelves): 위 줄에 나온 작품은 검색하지 않을 때 라이브러리에서 숨긴다. */
body.home-curated:not(.catalog-searching) .character-grid-card.is-home-featured { display: none !important; }
body.home-curated:not(.catalog-searching) .nox-library-block.is-home-exhausted { display: none !important; }
body.home-curated .rail-block.is-home-empty { display: none !important; }

/* 홈 최근 대화: 가로로 넘기는 이어하기 카드(작품 표지 + 마지막 한 줄 + 시간). */
.home-recent-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 320px);
  gap: var(--catalog-gap);
  padding: 2px var(--catalog-gutter) 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.home-recent-rail::-webkit-scrollbar { display: none; }
.home-recent-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ffffff14;
  border-radius: 12px;
  background: #ffffff08;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
}
.home-recent-card:hover, .home-recent-card:focus-visible { border-color: #ffffff30; background: #ffffff10; }
.home-recent-card img { width: 64px; height: 86px; object-fit: cover; object-position: 50% 25%; border-radius: 8px; }
.home-recent-copy { min-width: 0; display: grid; gap: 4px; }
.home-recent-copy strong { overflow: hidden; color: #f3f3f5; font: 700 16.5px/1.35 var(--c-sans); white-space: nowrap; text-overflow: ellipsis; }
.home-recent-copy span { display: -webkit-box; overflow: hidden; color: #b4b4bc; font: 500 15px/1.5 var(--c-sans); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.home-recent-copy small { color: #7c7c85; font: 500 14px/1.3 var(--c-sans); }
/* 비로그인·대화 없음이면 줄 전체를 숨긴다. hidden은 카테고리 필터(crack-parity.js)가 쓰므로 따로 둔다. */
.home-recent-block.is-recent-empty { display: none; }
