@charset "utf-8";

/* 컨테이너 유지 */
.sub-container.template-list-sub {
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    margin: 0 auto;
  }
  
  /* 상단 h2 (히어로 타이틀) */
  .sub-container.template-list-sub > .sub-sec-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 60px;
  }
  
  /* 내부링크 한 줄 박스(.sub-sec-title 말미) — .template-wrap과 동일 폭·좌우 패딩 */
  .sub-container.template-list-sub > .sub-sec-title > .template-head {
    max-width: 1600px;
    margin: 24px auto 0;
    width: 100%;
    padding: 30px 20px;
    box-sizing: border-box;

    text-align: center;

    background: #f8fafc;
    border-radius: 16px;
  }

/*
 * .template-inner + display: contents
 * - 목적: 필터·목록 .template-wrap에 동일한 max-width·padding을 적용하면서,
 *   DOM 순서(h1 → 히어로·내부링크 박스 → 필터 → 목록)로 .sub-container 플렉 배치를 맞춤.
 * - 동작: inner는 레이아웃 박스를 만들지 않고, 직계 자식이 .sub-container의 플렉 아이템으로 승격됨.
 * - Safari: display:contents는 iOS/macOS Safari 13.1+에서 flex 자식 승격이 안정화됨(그 이전은 버그 이슈 있었음).
 * - @supports fallback: contents 미지원 시 inner는 block(폭 제한); 자식은 세로 블록 흐름.
 */
.sub-container.template-list-sub > .template-inner {
    display: contents;
}

@supports not (display: contents) {

    .sub-container.template-list-sub > .template-inner {
        display: block;
        width: 100%;
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }
}

/* 공통 폭·패딩: 두 블록 동일 기준 (기존 .template-wrap 단독 max-width 제거) */
.sub-container.template-list-sub > .template-inner > .template-wrap {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

/* 페이지 SEO h1: .sub-container 직계 최상단 */
.sub-container.template-list-sub > h1.template-list-page-h1 {
    max-width: 1600px;
    margin: 20px auto 12px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.45;
    color: #333;
    letter-spacing: -0.02em;
    word-break: keep-all;
    overflow-wrap: break-word;
}

@media (max-width: 48rem) {

    .sub-container.template-list-sub > h1.template-list-page-h1 {
        font-size: 1rem;
        line-height: 1.5;
    }
}

/* 히어로: 상단 시각 제목은 h2 */
.sub-container .sub-sec-title h2.template-sub-hero-title {
    font-size: var(--common-sec-title-h1-size);
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 20px;
}

/* 내부링크 한 줄 */
.sub-container.template-list-sub .template-head > .template-list-desc {
    margin: 0 0 10px;
    padding: 0;
    max-width: 100%;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.55;
    color: #666;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.sub-container.template-list-sub .template-head .template-list-desc a {
    color: #222;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sub-container.template-list-sub .template-head .template-list-desc a:hover {
    color: #000;
}

/* =========================
   검색 (마크업만, 기능 미연결)
========================= */

.template-wrap--filters .template-search-form {
    width: 100%;
    margin: 0 0 24px;
}

.template-wrap--filters .template-search-box {
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 2px solid #222;
    background: none;
    box-sizing: border-box;
}

.template-wrap--filters .template-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    padding: 12px 8px 12px 0;
    font-size: 1rem;
    line-height: 1.4;
    color: #222;
}

.template-wrap--filters .template-search-input::placeholder {
    color: #999;
}

.template-wrap--filters .template-search-input:focus {
    outline: none;
}

.template-wrap--filters .template-search-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 8px 0 8px 8px;
    border: none;
    background: transparent;
    color: #222;
    cursor: pointer;
    line-height: 0;
}

.template-wrap--filters .template-search-btn:focus {
    outline: none;
}

.template-wrap--filters .template-search-btn svg {
    display: block;
}

.template-wrap--filters .template-search-keywords {
    width: 100%;
    margin: 0 0 20px;
}

.template-wrap--filters .template-search-keywords .keyword-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #666;
}

.template-wrap--filters .template-search-keywords .keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-wrap--filters .template-search-keywords .keyword-chip {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 999px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #333;
    text-decoration: none;
    background: #fff;
}

.template-wrap--filters .template-search-keywords .keyword-chip:hover {
    border-color: #222;
    color: #000;
}

.template-wrap--filters .template-search-keywords .keyword-chip.active {
    border-color: #222;
    background: #222;
    color: #fff;
}

/* =========================
   1차 parent
========================= */

.template-wrap .industry-filter-wrap .filter-parent {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
    /* 기본 회색 라인 */
}

.template-wrap .industry-filter-wrap .parent-tab {
    padding: 12px 0;
    border: none;
    background: transparent;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    color: #888;
    transition: all .2s ease;
}

.template-wrap .industry-filter-wrap .parent-tab.active {
    color: #111;
}

.template-wrap .industry-filter-wrap .parent-tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    /* border-bottom 위에 정확히 겹치게 */
    width: 100%;
    height: 2px;
    background: #111;
}


/* =========================
   2차 child
========================= */

.template-wrap .industry-filter-wrap .filter-child {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.template-wrap .industry-filter-wrap .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #f7f7f7;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all .2s ease;
}

.template-wrap .industry-filter-wrap .chip:hover {
    background: #eee;
}

.template-wrap .industry-filter-wrap .chip.active {
    background: #fff;
    border-color: #111;
    color: #111;
}


/* =========================
   X 아이콘
========================= */

.template-wrap .industry-filter-wrap .chip .x {
    display: none;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
    color: #111;
}

.template-wrap .industry-filter-wrap .chip .x svg {
    width: 100%;
    height: 100%;
    display: block;
}

.template-wrap .industry-filter-wrap .chip .x svg path {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.template-wrap .industry-filter-wrap .chip.active .x {
    display: inline-flex;
}

/*
 * 메인 index .sec3 .home-template-tabs(1차) ↔ /template .filter-parent
 * 동일 gap·글자 크기·줄바꿈 (인덱스 반응형 단계와 공유, main.css 중복 제거)
 */
@media (max-width: 1280px) {

    .template-wrap .industry-filter-wrap .filter-parent,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs {
        gap: 22px;
        flex-wrap: wrap;
    }

    .template-wrap .industry-filter-wrap .parent-tab,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs .tab {
        font-size: 18px;
    }
}

@media (max-width: 768px) {

    .template-wrap .industry-filter-wrap .filter-parent,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs {
        gap: 16px;
    }

    .template-wrap .industry-filter-wrap .parent-tab,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs .tab {
        font-size: 16px;
        padding: 10px 0;
    }
}

@media (max-width: 480px) {

    .template-wrap .industry-filter-wrap .filter-parent,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs {
        gap: 12px;
    }

    .template-wrap .industry-filter-wrap .parent-tab,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs .tab {
        font-size: 15px;
        padding: 8px 0;
    }

    .template-wrap .industry-filter-wrap .filter-child {
        gap: 8px;
    }

    .template-wrap .industry-filter-wrap .chip {
        padding: 8px 14px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {

    .template-wrap .industry-filter-wrap .filter-parent,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs {
        gap: 10px;
    }

    .template-wrap .industry-filter-wrap .parent-tab,
    .sec3 .home-template-sec3 .template-wrap .home-template-tabs .tab {
        font-size: 14px;
        padding: 8px 0;
    }

    .template-wrap .industry-filter-wrap .filter-child {
        gap: 6px;
    }

    .template-wrap .industry-filter-wrap .chip {
        padding: 7px 12px;
        font-size: 13px;
    }
}

.template-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.template-list-head .custom-select {
    position: relative;
    width: 160px;
}

.template-list-head .select-trigger {
    height: 2.8rem;
    line-height: 2.8rem;
    padding: 0 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
}

.template-list-head .custom-select::after {
    content: "";
    position: absolute;
    right: 0.875rem;
    top: 50%;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 1.5px solid #333;
    border-bottom: 1.5px solid #333;
    transform: translateY(-50%) rotate(45deg);
}

.template-list-head .custom-select.open::after {
    transform: translateY(-50%) rotate(-135deg);
}

.template-list-head .select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid #333;
    border-radius: 0.5rem;
    z-index: 20;
}

.template-list-head .custom-select.open .select-options {
    display: block;
}

.template-list-head .select-options li {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* 템플릿 목록 SEO용 섹션 제목: h2 유지, 화면에서만 숨김 (display/visibility 미사용) */
.template-wrap .template-section-title h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.template-wrap .template-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 2rem;
    row-gap: 3.5rem;
}

/* 태블릿 */
@media (max-width: 64rem) {

    /* 1024px */
    .template-wrap .template-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* 모바일 */
@media (max-width: 48rem) {

    /* 768px */
    .template-wrap .template-list {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.template-wrap .template-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* 썸네일 */
.template-wrap .template-thumb {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f1f1;
    height: 420px;
    border: 1px solid #eee;
}

.template-wrap .template-thumb::before {
    content: "";
    display: block;
    padding-top: 62%;
}

.template-wrap .thumb-track {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.8s ease;

}

.template-wrap .template-card:hover .thumb-track {
    transform: translateY(-35%);
}

.template-wrap .thumb-track img {}

/* 모바일 썸네일은 기본 숨김 */
.template-wrap .thumb-mo {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 100px;
    transform: translateY(30%);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
    pointer-events: none;
    border: 2px solid #111;
    border-radius: 8px;
}

.template-wrap .template-card:hover .thumb-mo {
    width: 100px;
    transform: translateY(0);
    opacity: 1;
}

/* 뱃지 */
.template-wrap .badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    background: #ff4d2d;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
}

/* 찜하기 */
.template-wrap .btn-like {
    position: absolute;
    top: 1.125rem;
    right: 1.125rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, .45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-wrap .btn-like .icon-like {
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    transition: opacity .2s ease, transform .2s ease;
}

.template-wrap .btn-like .icon-on {
    opacity: 0;
    transform: scale(0.8);
}

.template-wrap .btn-like.is-active .icon-off {
    opacity: 0;
}

.template-wrap .btn-like.is-active .icon-on {
    opacity: 1;
    transform: scale(1);
}


/* 하단 정보 */
.template-wrap .template-info {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.template-wrap .template-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.template-wrap .template-code {
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
}

.template-wrap .template-title {
    margin: 0;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: #555;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-wrap .template-price {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

.template-wrap .template-price strong {
    font-size: 1.05rem;
    font-weight: 700;
}

.template-wrap .template-price .discount {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ff4d2d;
}

/* /template 목록: 그리드 셀 폭 안에서 h2.template-title 한 줄 말줄임 (DOM·SEO 유지) */
.sub-container.template-list-sub .template-wrap .template-card {
    min-width: 0;
}

.sub-container.template-list-sub .template-wrap .template-info {
    min-width: 0;
    max-width: 100%;
}

.sub-container.template-list-sub .template-wrap .template-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ============================================================
   /template/ .template-inner: 메인 index .sec3 .home-template-sec3
   와 동일한 그리드·썸네일·모바일(hover 비활성) UX
   (클래스 구조 변경 없음, list.css 전역 768px 1열 규칙만 이 경로에서 덮어씀)
   ============================================================ */

@media (max-width: 1024px) {

    .sub-container.template-list-sub .template-inner .template-wrap .template-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        column-gap: 2rem;
        row-gap: 3rem;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb {
        height: auto;
        min-height: 240px;
        max-height: 360px;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 768px) {

    /* list.css 전역 48rem 1열 → /template/ 만 2열 유지 (sec3 동일) */
    .sub-container.template-list-sub .template-inner .template-wrap .template-list {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 2rem;
        row-gap: 2rem;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb {
        min-height: 200px;
        max-height: 300px;
    }

    /* PC 전용 hover UI: 모바일 캡처·트랙 슬라이드 비활성 */
    .sub-container.template-list-sub .template-inner .template-wrap .thumb-mo {
        display: none !important;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-card:hover .thumb-mo {
        display: none !important;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-card:hover .thumb-track {
        transform: none;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb .thumb-track img,
    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb img.thumb-pc {
        object-fit: cover;
        object-position: top center;
    }
}

@media (max-width: 480px) {

    .sub-container.template-list-sub .template-inner .template-wrap .template-list {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 0.5rem;
        row-gap: 1.25rem;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb {
        min-height: 160px;
        max-height: 260px;
    }
}

@media (max-width: 360px) {

    .sub-container.template-list-sub .template-inner .template-wrap .template-list {
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 1.25rem;
    }

    .sub-container.template-list-sub .template-inner .template-wrap .template-thumb {
        max-height: none;
    }
}
