/*
Theme Name: 프레스런 제휴마케팅 테마
Theme URI: https://presslearn.co.kr
Author: 로알남
Author URI: https://presslearn.co.kr
Description: 쿠팡파트너스 제휴마케팅에 최적화된 상품 허브 테마. 상품 1개 = 글 1개로 관리하고, 가격·링크만 넣으면 상품 카드와 상세 페이지가 자동으로 만들어집니다. 허브 꾸미기 페이지 하나로 디자인이 끝납니다.
Version: 1.8.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: productdamoa
*/

:root {
  --ink: #17202c;
  --ink-soft: #4b5563;
  --ink-muted: #8b95a1;
  --line: #e6e9ef;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --price: #e03131;
  --cta: #2b5ce6;
  --cta-dark: #1e46bd;
  --good-bg: #eef7ee;
  --good-text: #23662b;
  --bad-bg: #fdeeee;
  --bad-text: #9c2b2b;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; height: 62px;
}
.site-logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 18px; letter-spacing: -.01em;
  min-width: 0; flex-shrink: 0;
}
.site-logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-logo img { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; }

.header-search { flex: 1; max-width: 420px; }
.header-search form { display: flex; }
.header-search input[type="search"] {
  flex: 1; min-width: 0;
  font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-right: none;
  border-radius: 999px 0 0 999px;
  padding: 9px 18px; outline: none; background: var(--bg-alt);
}
.header-search input[type="search"]:focus { border-color: var(--cta); background: #fff; }
.header-search button {
  font: inherit; font-size: 14px; font-weight: 600; color: #fff;
  background: var(--cta); border: none; cursor: pointer;
  padding: 0 18px; border-radius: 0 999px 999px 0;
}
.header-search button:hover { background: var(--cta-dark); }

/* ---------- home hero ---------- */
.home-hero { padding: 44px 0 10px; text-align: center; }
.home-hero h1 { font-size: 30px; letter-spacing: -.02em; }
.home-hero p { margin-top: 8px; font-size: 16px; color: var(--ink-soft); }

.cat-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding-top: 22px; padding-bottom: 6px;
}
.cat-chips a {
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; background: #fff;
  transition: all .12s ease;
}
.cat-chips a:hover, .cat-chips a.active {
  border-color: var(--cta); color: var(--cta); background: #eaf0fe;
}

/* ---------- product grid ---------- */
.archive-title { padding: 34px 0 0; font-size: 22px; }
.grid-section { padding: 26px 0 50px; }
.product-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.product-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff;
  transition: box-shadow .15s ease, transform .15s ease;
  display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(23,32,44,.08); transform: translateY(-2px); }
.card-thumb { aspect-ratio: 1 / 1; background: var(--bg-alt); position: relative; }
.card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.card-badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 12px; font-weight: 700; color: var(--cta);
  background: #eaf0fe; padding: 3px 10px; border-radius: 999px;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-cat { font-size: 12px; color: var(--ink-muted); }
.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-rating { font-size: 13px; color: var(--ink-soft); }
.card-rating .stars { color: #f5a623; }
.card-price { margin-top: auto; padding-top: 6px; font-size: 17px; font-weight: 800; color: var(--price); }
.card-price small { font-size: 13px; font-weight: 600; }
.card-price .dc { color: var(--price); margin-right: 4px; }

.no-posts { padding: 60px 0; text-align: center; color: var(--ink-soft); }

/* pagination */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 6px 0 20px; }
.pagination .page-numbers {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; padding: 0 10px;
}
.pagination .page-numbers.current { background: var(--cta); border-color: var(--cta); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--cta); color: var(--cta); }

/* ---------- single product ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 22px 0 0; font-size: 14px; color: var(--ink-soft);
}
.back-link:hover { color: var(--cta); }

.product-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: 36px;
  padding-top: 24px; padding-bottom: 40px; align-items: start;
}
.pt-media { position: sticky; top: 82px; min-width: 0; }
.pt-figure {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; aspect-ratio: 1 / 1; margin: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pt-figure img { width: 100%; height: 100%; object-fit: contain; }
.pt-thumbs .pt-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pt-info .badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  color: var(--cta); background: #eaf0fe;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 12px;
}
.pt-info h1 { font-size: 26px; line-height: 1.4; letter-spacing: -.02em; margin: 12px 0 0; }
.pt-info .subtitle { margin-top: 8px; font-size: 16px; line-height: 1.55; color: var(--ink-soft); }
.pt-info .rating { margin-top: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--ink-soft); }
.pt-info .rating .stars { color: #f5a623; letter-spacing: 2px; margin-right: 6px; }
.pt-info .rating strong { color: var(--ink); }

.price-box { margin-top: 16px; }
.price-original { font-size: 14px; color: var(--ink-muted); text-decoration: line-through; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.discount { font-size: 22px; font-weight: 800; color: var(--price); }
.price-label { font-size: 14px; color: var(--ink-soft); }
.price { font-size: 32px; font-weight: 800; color: var(--price); letter-spacing: -.02em; }
.price small { font-size: 19px; font-weight: 700; }

.cta-btn {
  display: block; margin-top: 20px;
  background: var(--cta); color: #fff; text-align: center;
  font-size: 17px; font-weight: 700; padding: 16px 20px;
  border-radius: var(--radius);
  transition: background .15s ease, transform .1s ease;
}
.cta-btn:hover { background: var(--cta-dark); }
.cta-btn:active { transform: scale(.985); }
.top-disclosure {
  display: block; margin: 14px 0 0;
  font-size: 13px; color: var(--ink-soft); line-height: 1.7;
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px;
}
.cta-note { margin-top: 12px; font-size: 13px; color: var(--ink-muted); line-height: 1.8; }


/* ---------- single sections ---------- */
.section { padding: 36px 0; border-top: 1px solid var(--line); }
.section-alt { background: var(--bg-alt); }
.section h2 {
  font-size: 20px; letter-spacing: -.01em; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.section h2::before {
  content: ""; width: 4px; height: 17px; border-radius: 2px; background: var(--cta);
}

.spec-table { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; }
.spec-table tr { border-bottom: 1px solid var(--line); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table th {
  text-align: left; font-weight: 500; color: var(--ink-soft);
  padding: 11px 8px; width: 30%; overflow-wrap: break-word;
}
.spec-table td { padding: 11px 8px; font-weight: 600; overflow-wrap: break-word; }

.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pc-card { border-radius: var(--radius); padding: 20px; font-size: 15px; }
.pc-card.good { background: var(--good-bg); }
.pc-card.bad { background: var(--bad-bg); }
.pc-card h3 { font-size: 15px; margin-bottom: 12px; }
.pc-card.good h3 { color: var(--good-text); }
.pc-card.bad h3 { color: var(--bad-text); }
.pc-card ul { list-style: none; }
.pc-card li { padding: 4px 0 4px 22px; position: relative; }
.pc-card.good li::before { content: "✓"; position: absolute; left: 0; color: var(--good-text); font-weight: 700; }
.pc-card.bad li::before { content: "✕"; position: absolute; left: 0; color: var(--bad-text); font-weight: 700; }

.review-body { font-size: 16px; color: #2c3540; }
.review-body p { margin-bottom: 1.1em; }
.review-body h2, .review-body h3 { margin: 1.6em 0 .6em; }
.review-body h2 { font-size: 20px; }
.review-body h3 { font-size: 18px; }
.review-body img { border-radius: 12px; margin: 1em 0; }
.review-body ul, .review-body ol { padding-left: 1.4em; margin-bottom: 1.1em; }

.final-cta { text-align: center; padding: 44px 0 52px; }
.final-cta p.lead { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.final-cta p.sub { font-size: 15px; color: var(--ink-soft); margin-bottom: 4px; }
.final-cta .cta-btn { max-width: 480px; margin-left: auto; margin-right: auto; }

/* generic page */
.page-body { padding: 40px 0 60px; }
.page-body h1 { font-size: 26px; margin-bottom: 20px; }
.page-content { font-size: 16px; }
.page-content p { margin-bottom: 1.1em; }
.page-content h2 { font-size: 20px; margin: 1.6em 0 .6em; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--bg-alt);
  padding: 30px 0; text-align: center;
}
.footer-menu { display: flex; gap: 18px; justify-content: center; margin-bottom: 14px; font-size: 14px; color: var(--ink-soft); }
.footer-menu a:hover { color: var(--cta); }
.disclosure {
  font-size: 13px; color: var(--ink-soft); background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; display: inline-block; margin-bottom: 14px;
}
.copyright { font-size: 12px; color: var(--ink-muted); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-top { grid-template-columns: 1fr; gap: 22px; padding-top: 16px; }
  .pt-media { position: static; max-width: 440px; margin: 0 auto; width: 100%; }
  .home-hero h1 { font-size: 24px; }
  .header-search { display: none; }
  .mobile-search { display: block; padding: 14px 0 0; }
  .pc-grid { grid-template-columns: 1fr; }
}
@media (min-width: 721px) {
  .mobile-search { display: none; }
}
@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
  .card-body { padding: 10px 12px 12px; }
  .card-title { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .product-card, .cta-btn { transition: none; }
}

.site-logo-img { height: 28px; width: auto; display: block; }

/* ---------- v1.1: 신규 기능 ---------- */
/* 홈 섹션 제목 / 인기 상품 */
.home-section-title { font-size: 20px; font-weight: 800; margin: 26px 0 14px; }
.popular-products { padding-top: 6px; }
.product-grid.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .product-grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 정렬 탭 */
.pdm-sort-tabs { display: flex; gap: 6px; margin: 0 0 16px; }
.pdm-sort-tab { font-size: 13.5px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); }
.pdm-sort-tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* 가격 기준일 */
.price-date { font-size: 12px; color: var(--ink-muted); margin-bottom: 2px; }

/* 광고 슬롯 */
.pdm-slot { margin: 22px auto; }

/* 관련 상품 */
.related-products { border-top: 1px solid var(--line); }
.related-products h2 { font-size: 20px; font-weight: 800; margin-bottom: 16px; }

/* 모바일 하단 고정 구매 버튼 */
.pdm-sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: none; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.pdm-sticky-cta .sc-price { font-size: 14px; white-space: nowrap; }
.pdm-sticky-cta .sc-price strong { color: var(--price); font-size: 17px; }
.pdm-sticky-cta .cta-btn { flex: 1; margin: 0; padding: 12px 10px; font-size: 15px; text-align: center; }
@media (max-width: 768px) {
  .pdm-sticky-cta { display: flex; }
  body.single { padding-bottom: 74px; }
}

/* ---------- v1.2: 페이지 구성 ---------- */
/* 상단 배치 */
.product-top.pt-layout-right .pt-media { order: 2; }
.product-top.pt-layout-right .pt-info { order: 1; }
.product-top.pt-layout-stack { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; gap: 20px; }
.product-top.pt-layout-stack .pt-media { max-width: 440px; margin: 0 auto; width: 100%; position: static; }
.product-top.pt-layout-stack .pt-info { text-align: center; }
.product-top.pt-layout-stack .pt-info .price-row { justify-content: center; }
.product-top.pt-layout-stack .pt-info .cta-btn { max-width: 480px; margin-left: auto; margin-right: auto; }
.product-top.pt-layout-stack .pt-thumbs { justify-content: center; }

/* 카드 열 수 */
.product-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .product-grid.cols-3, .product-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .product-grid, .product-grid.cols-2 { grid-template-columns: 1fr; } }



/* ---------- v1.6: 상품 이미지 갤러리 ---------- */
#pdm-main-img { transition: opacity .15s ease; }
.pt-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pt-thumb {
  width: 64px; height: 64px; padding: 0; border: 2px solid var(--line); border-radius: 10px;
  overflow: hidden; cursor: pointer; background: #fff; flex: none;
}
.pt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-thumb.is-active { border-color: var(--cta); }
.pt-thumb:hover { border-color: var(--cta-dark); }
@media (max-width: 560px) { .pt-thumb { width: 56px; height: 56px; } }

/* ---------- v1.7.1: 모바일 상단 정보 간격 ---------- */
@media (max-width: 768px) {
  .pt-info { padding-top: 10px; }
  .pt-info h1 { font-size: 22px; line-height: 1.45; margin-top: 14px; }
  .pt-info .subtitle { margin-top: 10px; }
  .pt-info .rating { margin-top: 18px; padding-bottom: 18px; }
  .price-box { margin-top: 18px; }
  .price-row { margin-top: 6px; }
  .pt-info .cta-btn { margin-top: 18px; }
  .top-disclosure { margin-top: 10px; font-size: 12.5px; line-height: 1.6; }
  .pt-thumbs { margin-top: 12px; }
}

/* ---------- v1.7.3: 레이아웃 안정화 (광고·긴 텍스트 오버플로 방어) ---------- */
main#content { overflow-x: clip; }
.pt-info { min-width: 0; }
.pt-info h1, .pt-info .subtitle { overflow-wrap: break-word; }

/* 광고 슬롯: 컨테이너보다 큰 광고 단위가 페이지를 밀어내지 않도록 */
.pdm-slot { min-width: 0; max-width: 100%; overflow-x: hidden; text-align: center; }
.pdm-slot iframe, .pdm-slot ins { max-width: 100%; }

/* 본문(리뷰): 광고·임베드·긴 문자열·표 방어 */
.review-body { min-width: 0; overflow-wrap: break-word; }
.review-body iframe, .review-body ins, .review-body embed, .review-body object, .review-body video { max-width: 100%; }
.review-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; }

/* 장단점 카드: 그리드 자식 최소폭 해제 + 긴 문장 줄바꿈 */
.pc-card { min-width: 0; overflow-wrap: break-word; }
