/*
 Theme Name:   Astra Child
 Theme URI:    https://jiwonpick.com
 Description:  Astra 자식 테마 — 지원픽(jiwonpick.com) 커스텀 기능 포함
 Author:       jiwonpick
 Author URI:   https://jiwonpick.com
 Template:     astra
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  astra-child
*/

/* ============================================================
   JIWONPICK CHILD THEME — Additional Styles
   아래 클래스들은 jiwonpick-custom.css(Customizer)의 토큰을 공유
   ============================================================ */


/* ── 1. Astra 블로그 그리드 오버라이드 ──
   블로그/아카이브 페이지에서 Astra의 flexbox 레이아웃을
   3열 CSS Grid로 교체한다.
   ─────────────────────────────────────────────────────────── */
body.blog       .ast-row,
body.archive    .ast-row,
body.home.blog  .ast-row,
body.category   .ast-row,
body.tag        .ast-row,
body.search     .ast-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.5rem !important;
    margin-left:  0 !important;
    margin-right: 0 !important;
}

/* Astra 컬럼 래퍼 초기화 */
body.blog      .ast-row > *,
body.archive   .ast-row > *,
body.home.blog .ast-row > *,
body.category  .ast-row > *,
body.tag       .ast-row > *,
body.search    .ast-row > * {
    width:       100% !important;
    max-width:   100% !important;
    padding-left:  0 !important;
    padding-right: 0 !important;
    float: none !important;
    margin-bottom: 0 !important;
}

/* 카드가 그리드 셀 높이를 채우도록 */
body.blog .jw-post,
body.archive .jw-post,
body.home .jw-post,
body.category .jw-post,
body.tag .jw-post,
body.search .jw-post {
    height: 100%;
}

/* 태블릿 — 768px 이상 1024px 미만: 2열 */
@media (max-width: 1023px) {
    body.blog       .ast-row,
    body.archive    .ast-row,
    body.home.blog  .ast-row,
    body.category   .ast-row,
    body.tag        .ast-row,
    body.search     .ast-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.2rem !important;
    }
}

/* 모바일 — 599px 이하: 1열 */
@media (max-width: 599px) {
    body.blog       .ast-row,
    body.archive    .ast-row,
    body.home.blog  .ast-row,
    body.category   .ast-row,
    body.tag        .ast-row,
    body.search     .ast-row {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}


/* ── 2. 썸네일 링크 래퍼 ── */
.jw-post__thumb-link {
    display: block;
    flex-shrink: 0;
    overflow: hidden;
    text-decoration: none !important;
    color: inherit !important;
}

/* Astra가 .ast-grid-common-col 내부에서 추가하는 여백 제거 */
.ast-grid-common-col .jw-post,
.post-content .jw-post {
    margin-bottom: 0 !important;
}


/* ── 3. 카드 상단 행 (태그 + 금액 배지) ── */
.jw-post__toprow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .45rem;
}

.jw-post__toprow .jw-post__tags {
    flex: 1 1 auto;
    min-width: 0;
}

/* 금액 배지 */
.jw-amount-badge {
    flex-shrink: 0;
    font-size: .75rem;
    font-weight: 800;
    color: #e53e3e !important;
    background: #fff5f5 !important;
    border: 1px solid #fed7d7 !important;
    border-radius: 8px !important;
    padding: .18rem .58rem;
    white-space: nowrap;
    letter-spacing: -.01em;
    line-height: 1.5;
}


/* ── 4. 제목 링크 스타일 초기화 ── */
.jw-post__title a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color .15s;
}

.jw-post__title a:hover {
    color: var(--jw-navy, #1a365d) !important;
}


/* ── 5. 카드 푸터 칩 그룹 ── */
.jw-post__chips {
    display: flex;
    flex-wrap: wrap;
    gap: .28rem;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

/* 소형 칩 베이스 */
.jw-chip-sm {
    display: inline-block;
    font-size: .62rem;
    font-weight: 600;
    padding: .14rem .46rem;
    border-radius: 9999px;
    letter-spacing: .01em;
    line-height: 1.5;
    white-space: nowrap;
}

/* 연령대 칩 — 블루 */
.jw-chip-sm--age {
    background: #ebf8ff !important;
    color: #2b6cb0 !important;
    border: 1px solid #bee3f8 !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
}

/* 난이도 칩 */
.jw-chip-sm--easy {
    background: rgba(56, 161, 105, .1);
    color: #276749;
    border: 1px solid rgba(56, 161, 105, .25);
}
.jw-chip-sm--normal {
    background: rgba(214, 158, 46, .1);
    color: #975a16;
    border: 1px solid rgba(214, 158, 46, .25);
}
.jw-chip-sm--complex {
    background: rgba(229, 62, 62, .08);
    color: #c53030;
    border: 1px solid rgba(229, 62, 62, .2);
}


/* ── 6. D-day 배지 (카드 푸터 우측) ── */
.jw-dday {
    flex-shrink: 0;
    font-size: .69rem;
    font-weight: 700;
    padding: .18rem .5rem;
    border-radius: 9999px;
    letter-spacing: .01em;
    white-space: nowrap;
    line-height: 1.5;
}

/* 마감됨 */
.jw-dday--expired {
    color: var(--jw-muted, #718096);
    background: rgba(113, 128, 150, .08);
    border: 1px solid rgba(113, 128, 150, .2);
    text-decoration: line-through;
}

/* D-Day (당일) */
.jw-dday--today {
    color: #fff;
    background: #dc2626;
    animation: jw-dday-glow 2s ease-in-out infinite;
}

@keyframes jw-dday-glow {
    0%, 100% { box-shadow: 0 2px 6px  rgba(220, 38, 38, .35); }
    50%       { box-shadow: 0 2px 16px rgba(220, 38, 38, .65); }
}

/* D≤7 마감임박 — 빨강 + 펄스 */
.jw-dday--urgent {
    color: #fff;
    background: #dc2626;
    border: none;
    animation: jw-dday-glow 2s ease-in-out infinite;
}

/* D8-30 — 오렌지 */
.jw-dday--normal {
    color: #fff;
    background: #ed8936;
    border: none;
}

/* D31+ — 회색 */
.jw-dday--far {
    color: var(--jw-muted, #718096);
    background: rgba(113, 128, 150, .06);
    border: 1px solid rgba(113, 128, 150, .15);
}


/* ── 7. 빈 상태(No Posts) 블록 ── */
.jw-no-posts {
    text-align: center;
    padding: 5rem 1.5rem;
    max-width: 480px;
    margin: 0 auto;
}

.jw-no-posts__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: var(--jw-surface2, #edf2f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jw-no-posts__icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--jw-muted, #718096);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.jw-no-posts__title {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--jw-text, #1a202c) !important;
    margin-bottom: .75rem;
    line-height: 1.4;
}

.jw-no-posts__sub {
    font-size: .875rem;
    color: var(--jw-muted, #718096);
    margin-bottom: 1.5rem;
    line-height: 1.65;
}

.jw-no-posts__form {
    display: flex;
    gap: .5rem;
    max-width: 320px;
    margin: 0 auto 1rem;
}

.jw-no-posts__form .search-field {
    flex: 1;
    padding: .6rem 1rem;
    border: 1.5px solid var(--jw-border, #e2e8f0);
    border-radius: 9999px;
    font-size: .875rem;
    outline: none;
    transition: border-color .15s;
    background: #fff;
}

.jw-no-posts__form .search-field:focus {
    border-color: var(--jw-mint, #38b2ac);
}


/* ── 8. 소형 버튼 ── */
.jw-btn-sm {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--jw-navy, #1a365d);
    color: #fff !important;
    font-size: .8rem;
    font-weight: 600;
    padding: .6rem 1.25rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: background .18s ease, transform .15s ease;
    line-height: 1;
}

.jw-btn-sm:hover {
    background: var(--jw-navy-dark, #0f2444);
    color: #fff !important;
    transform: translateY(-1px);
}

.jw-btn-sm--outline {
    background: transparent !important;
    color: var(--jw-navy, #1a365d) !important;
    border: 1.5px solid var(--jw-navy, #1a365d) !important;
}

.jw-btn-sm--outline:hover {
    background: var(--jw-navy, #1a365d) !important;
    color: #fff !important;
}


/* ── 9. 필터 섹션 래퍼 ── */
.jw-filter-section {
    width: 100%;
    margin: 0 auto;
}


/* ── 10. 필터 상단 바 (카테고리 탭 + 정렬 드롭다운) ── */
.jw-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 16px 1.25rem;
    border-radius: 12px 12px 0 0;
}

/* 탭 컨테이너 — 넘치면 가로 스크롤, 스크롤바 숨김 */
.jw-filter-tabs {
    display: flex;
    gap: .5rem;
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.jw-filter-tabs::-webkit-scrollbar { display: none; }

/* 탭 버튼 베이스 — pill 스타일 */
.jw-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    font-size: .84rem;
    font-weight: 500;
    color: #4a5568;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.4;
    margin-bottom: 0;
}

.jw-tab:hover {
    border-color: #1a365d;
    color: #1a365d;
}

/* 활성 탭 — navy 배경 + 흰색 */
.jw-tab--active {
    background: #1a365d !important;
    color: #fff !important;
    border-color: #1a365d !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(26, 54, 93, .25);
}

/* 정렬 드롭다운 */
.jw-sort-select {
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .55rem center / 14px 14px;
    border: 1.5px solid var(--jw-border, #e2e8f0);
    border-radius: 9999px;
    padding: .38rem 2rem .38rem .85rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--jw-text, #1a202c);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    min-width: 98px;
}

.jw-sort-select:focus {
    outline: none;
    border-color: var(--jw-navy, #1a365d);
    box-shadow: 0 0 0 2px rgba(26, 54, 93, .1);
}


/* ── 11. 대상 필터 칩 행 ── */
.jw-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: 1.5rem;
}

/* "대상" 레이블 */
.jw-filter-chips__label {
    font-size: .7rem;
    font-weight: 700;
    color: var(--jw-muted, #718096);
    letter-spacing: .05em;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-right: .15rem;
}

/* 필터 칩 베이스 */
.jw-fchip {
    display: inline-flex;
    align-items: center;
    padding: .3rem .78rem;
    font-size: .78rem;
    font-weight: 600;
    color: #4a5568;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .12s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    line-height: 1.4;
}

.jw-fchip:hover {
    border-color: #1a365d;
    color: #1a365d;
}

/* 활성 칩 — navy 배경 + 흰색 텍스트 */
.jw-fchip--active {
    background: var(--jw-navy, #1a365d) !important;
    border-color: var(--jw-navy, #1a365d) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(26, 54, 93, .22);
}


/* ── 12. 필터 결과 그리드 ── */
.jw-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    min-height: 180px;
}


/* ── 13. 로딩 스피너 ── */
.jw-filter-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5rem 0;
}

.jw-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--jw-border, #e2e8f0);
    border-top-color: var(--jw-navy, #1a365d);
    border-radius: 50%;
    animation: jw-spin .7s linear infinite;
}

@keyframes jw-spin {
    to { transform: rotate(360deg); }
}


/* ── 14. 빈 상태 / 에러 블록 ── */
.jw-filter-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
}

.jw-filter-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1.5rem;
    font-size: .9rem;
    color: #c53030;
}

.jw-filter-empty__icon {
    width: 54px;
    height: 54px;
    background: var(--jw-surface2, #edf2f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
}

.jw-filter-empty__icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--jw-muted, #718096);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.jw-filter-empty__text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--jw-text, #1a202c);
    margin-bottom: .35rem;
    line-height: 1.5;
}

.jw-filter-empty__sub {
    font-size: .85rem;
    color: var(--jw-muted, #718096);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}


/* ── 15. 더 보기 버튼 ── */
.jw-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.jw-load-more {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #fff;
    color: var(--jw-navy, #1a365d);
    border: 1.5px solid var(--jw-navy, #1a365d);
    font-size: .84rem;
    font-weight: 700;
    padding: .62rem 1.75rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background .18s, color .18s, transform .15s, box-shadow .18s;
    line-height: 1;
}

.jw-load-more:hover {
    background: var(--jw-navy, #1a365d);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, .18);
}

.jw-load-more svg {
    stroke: currentColor;
    transition: transform .2s;
}

.jw-load-more:hover svg {
    transform: translateY(2px);
}

.jw-load-more:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}


/* ── 16. 필터 섹션 반응형 ── */
@media (max-width: 1023px) {
    .jw-filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
}

@media (max-width: 599px) {
    .jw-filter-bar {
        flex-wrap: wrap;
        gap: .55rem;
        padding-bottom: .55rem;
    }
    .jw-filter-tabs {
        order: 1;
        width: 100%;
    }
    .jw-sort-select {
        order: 2;
        margin-left: auto;
    }
    .jw-filter-chips {
        margin-bottom: 1.1rem;
        gap: .35rem;
    }
    .jw-filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

