@charset "utf-8";

/* ─── Template Grid (Latest Skin) ─────────────────────── */
.tpl_grid { position: relative; width: 100% }

/* Header */
.tpl_grid_header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 60px; gap: 24px; flex-wrap: wrap;
}
.tpl_grid_label {
    display: block; font-size: 12px; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--primary); margin-bottom: 12px;
}
.tpl_grid_title {
    font-size: clamp(28px, 4vw, 48px); font-weight: 700;
    line-height: 1.2; margin-bottom: 12px;
}
.tpl_grid_desc {
    color: var(--muted-foreground); font-size: 15px; line-height: 1.6; max-width: 480px;
}
.tpl_grid_more {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--foreground); text-decoration: none;
    padding: 12px 24px; border: 1px solid var(--border); border-radius: 100px;
    transition: all 0.3s; white-space: nowrap;
}
.tpl_grid_more:hover {
    background: var(--foreground); color: var(--background);
}

/* Filter Tabs */
.tpl_grid_filter {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 40px;
}
.tpl_filter_btn {
    padding: 10px 22px; background: transparent;
    border: 1px solid var(--border); border-radius: 100px;
    font-size: 13px; font-weight: 500; color: var(--muted-foreground);
    cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.tpl_filter_btn:hover {
    border-color: var(--foreground); color: var(--foreground);
}
.tpl_filter_btn.active {
    background: var(--foreground); border-color: var(--foreground); color: var(--background);
}

/* Grid */
.tpl_grid_list {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* 등급 배지 (썸네일 좌상단) */
.tpl_grid_level {
    position: absolute; top: 12px; left: 12px;
    padding: 5px 12px; font-size: 11px; font-weight: 600;
    letter-spacing: 0.05em;
    background: rgba(255,255,255,0.95); color: #111;
    border-radius: 100px; backdrop-filter: blur(6px);
    z-index: 2;
}
.tpl_grid_level.tpl_level_tpl_lv_고급형,
.tpl_grid_level.tpl_level_tpl_lv_ { background: var(--primary); color: var(--primary-foreground) }

/* No Results */
.tpl_grid_nores {
    padding: 80px 0; text-align: center;
    color: var(--muted-foreground); font-size: 15px;
}

/* Item */
.tpl_grid_item {
    cursor: pointer; transition: transform 0.4s cubic-bezier(0.25,0.1,0.25,1);
}
.tpl_grid_item:hover { transform: translateY(-8px) }

/* Thumbnail */
.tpl_grid_thumb {
    position: relative; overflow: hidden; border-radius: 12px;
    aspect-ratio: 16/11; background: var(--secondary);
}
.tpl_grid_thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25,0.1,0.25,1);
}
.tpl_grid_item:hover .tpl_grid_thumb img { transform: scale(1.05) }

/* Overlay */
.tpl_grid_overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.tpl_grid_item:hover .tpl_grid_overlay { opacity: 1 }

.tpl_preview_btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px; background: #fff; color: #111;
    border: none; border-radius: 100px; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: transform 0.2s;
}
.tpl_preview_btn:hover { transform: scale(1.05) }

/* Info */
.tpl_grid_info { padding: 16px 4px 0 }
.tpl_grid_name { font-size: 17px; font-weight: 600; margin-bottom: 6px }
.tpl_grid_tag {
    display: inline-block; font-size: 12px; color: var(--muted-foreground);
    padding: 4px 12px; background: var(--secondary); border-radius: 100px;
}

/* Empty */
.tpl_grid_empty {
    grid-column: 1 / -1; padding: 80px 0;
    text-align: center; color: var(--muted-foreground);
}

/* ─── Preview Modal ───────────────────────────────────── */
.tpl_modal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.85);
    flex-direction: column;
    width: 90vw;
    height: 90vh;
    margin: auto;
    border-radius: 24px;
    box-shadow: 0 6px 20px rgba(0,0,0,.5);
    animation: tplFadeIn 0.3s ease;
    overflow: hidden;
}
@keyframes tplFadeIn { from { opacity:0 } to { opacity:1 } }

.tpl_modal_header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: var(--background); border-bottom: 1px solid var(--border);
    flex-shrink: 0; gap: 16px;
}

.tpl_modal_device { display: flex; gap: 4px }
.tpl_device_btn {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; border-radius: 8px;
    color: var(--muted-foreground); cursor: pointer; transition: all 0.2s;
}
.tpl_device_btn:hover { color: var(--foreground) }
.tpl_device_btn.active {
    background: var(--secondary); border-color: var(--border); color: var(--foreground);
}

.tpl_modal_title {
    font-size: 14px; font-weight: 500; color: var(--foreground);
}

.tpl_modal_actions { display: flex; align-items: center; gap: 12px }

.tpl_consult_btn {
    padding: 8px 20px; background: var(--primary); color: var(--primary-foreground);
    text-decoration: none; font-size: 13px; font-weight: 500;
    border-radius: 6px; transition: opacity 0.2s;
}
.tpl_consult_btn:hover { opacity: 0.85 }

.tpl_close_btn {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: var(--muted-foreground);
    cursor: pointer; border-radius: 8px; transition: all 0.2s;
}
.tpl_close_btn:hover { background: var(--secondary); color: var(--foreground) }

/* 서브페이지 네비게이션 (고급형 전용) */
.tpl_modal_subnav {
    display: flex; gap: 4px; padding: 10px 20px;
    background: var(--secondary); border-bottom: 1px solid var(--border);
    flex-shrink: 0; overflow-x: auto;
}
.tpl_subnav_btn {
    padding: 7px 16px; background: transparent; border: 1px solid transparent;
    border-radius: 6px; font-size: 13px; color: var(--muted-foreground);
    cursor: pointer; white-space: nowrap; transition: all 0.2s;
    font-family: inherit;
}
.tpl_subnav_btn:hover { color: var(--foreground) }
.tpl_subnav_btn.active {
    background: var(--background); border-color: var(--border); color: var(--foreground);
}

.tpl_modal_body {
    flex: 1; display: flex; justify-content: center;
    padding: 20px; overflow: hidden; background: #e5e5e5;
}
.tpl_iframe {
    width: 100%; height: 100%; border: none; border-radius: 8px;
    background: #fff; transition: max-width 0.4s cubic-bezier(0.25,0.1,0.25,1);
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .tpl_grid_list { grid-template-columns: repeat(2, 1fr); gap: 24px }
}
@media (max-width: 640px) {
    .tpl_grid_list { grid-template-columns: 1fr; gap: 20px }
    .tpl_grid_header { flex-direction: column; align-items: flex-start }
    .tpl_modal_header { flex-wrap: wrap; justify-content: center }
    .tpl_modal_title { order: -1; width: 100%; text-align: center }
    .tpl_consult_btn { font-size: 12px; padding: 8px 14px }
}
