/*
Theme Name: Agrigrear Theme
Theme URI: https://example.com
Author: Custom
Author URI: https://example.com
Description: Lightweight custom blog theme — editorial magazine redesign
Version: 1.2
Text Domain: agrigrear-theme
*/

:root {
    --bg:        #faf8f4;
    --surface:   #ffffff;
    --ink:       #1a1614;
    --ink-soft:  #5a544f;
    --ink-muted: #8c857d;
    --line:      #ece7df;
    --line-soft: #f2ede3;
    --accent:    #8b4513; /* 따뜻한 brown */
    --accent-ink:#6b3410;
    --chip-bg:   #f5f0e6;
    --shadow-sm: 0 1px 2px rgba(26,22,20,.04);
    --shadow-md: 0 4px 16px rgba(26,22,20,.06);
    --shadow-lg: 0 12px 40px rgba(26,22,20,.10);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
    margin: 0; color: var(--ink);
    font-family: var(--font);
    font-feature-settings: "ss06", "ss07";
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--accent); color: #fff; }

/* --------- 스크린리더 --------- */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link.screen-reader-text:focus {
    position: static !important;
    width: auto; height: auto; margin: 0; clip: auto;
    display: inline-block; padding: 8px 14px; background: var(--ink); color: #fff;
}

/* --------- 레이아웃 --------- */
.site-wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.site-main { padding: 36px 0 80px; }

/* --------- 헤더 --------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: rgba(250,248,244,.85);
    backdrop-filter: saturate(180%) blur(8px);
    position: sticky; top: 0; z-index: 50;
}
.site-header-inner {
    max-width: 1240px; margin: 0 auto; padding: 16px 28px;
    display: flex; justify-content: space-between; align-items: center; gap: 24px;
}
.site-branding { display: flex; align-items: center; gap: 10px; }
.site-logo { display: flex; align-items: center; }
.site-logo svg, .site-logo img, .custom-logo {
    width: 30px !important; height: 30px !important;
    border-radius: 8px;
}
.site-title-text {
    font-size: 19px; font-weight: 700;
    color: var(--ink); letter-spacing: -0.02em;
    line-height: 1; white-space: nowrap;
}
.site-title-text:hover { color: var(--accent-ink); }

/* 검색 --------- */
.site-search {
    display: flex; align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 6px 0 18px; height: 42px;
    min-width: 300px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.site-search:focus-within {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(26,22,20,.06);
}
.site-search input[type="search"] {
    flex: 1; border: 0; outline: 0; background: transparent;
    font-size: 14px; color: var(--ink); height: 100%;
    padding: 0; min-width: 0;
    font-family: inherit;
}
.site-search input[type="search"]::placeholder { color: var(--ink-muted); }
.site-search input[type="search"]::-webkit-search-decoration,
.site-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.site-search button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    background: var(--ink); border: 0; border-radius: 999px;
    color: #fff; cursor: pointer; transition: transform .15s;
}
.site-search button:hover { transform: scale(1.08); }

/* --------- 카테고리 --------- */
.cat-nav {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 8px 0 40px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-soft);
}
.cat-link {
    display: inline-flex; align-items: center;
    padding: 8px 14px; border: 1px solid transparent;
    border-radius: 999px; background: transparent;
    font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
    cursor: pointer; transition: all .15s;
    letter-spacing: -0.01em; white-space: nowrap;
}
.cat-link:hover { color: var(--ink); background: var(--chip-bg); }
.cat-link.is-active {
    background: var(--ink); color: #fff; border-color: var(--ink);
    font-weight: 600;
}

/* --------- 인기글 헤더 --------- */
.popular-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin: 0 0 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-soft);
}
.popular-head:empty { display: none; }
.popular-head .section-title { margin: 0; }
.popular-nav {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    box-shadow: var(--shadow-sm);
}
.popular-rank {
    font-size: 12px; color: var(--ink-muted); font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    padding: 0 12px 0 10px;
    border-right: 1px solid var(--line-soft);
    margin-right: 4px;
    align-self: stretch;
    display: inline-flex; align-items: center;
}
.pop-page {
    font-size: 13px; color: var(--ink);
    min-width: 44px; text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding: 0 6px;
    align-self: center;
}
.pop-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent; color: var(--ink-soft);
    font-size: 13px; cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    line-height: 1;
}
.pop-btn:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--ink); color: #fff;
}
.pop-btn:disabled, .pop-btn[aria-disabled="true"] { opacity: .25; cursor: not-allowed; }

/* --------- 섹션 타이틀 --------- */
.section-title {
    font-size: 28px; margin: 0 0 24px;
    font-weight: 700; letter-spacing: -0.025em;
    color: var(--ink); white-space: nowrap;
}
.section-title--popular { position: relative; padding-left: 16px; }
.section-title--popular::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 4px; background: var(--accent); border-radius: 2px;
}

/* --------- 인기글 그리드 --------- */
.home-top {
    display: grid; grid-template-columns: 1.6fr 1fr;
    gap: 20px; margin-bottom: 60px;
}
.home-side { display: grid; grid-template-rows: 1fr 1fr; gap: 20px; }

/* --------- 카드 --------- */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
    position: relative;
}
.card > a { display: block; }
.home-top .card {
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}
.home-top .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.post-list .card, .related-grid .card {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
}
.post-list .card:hover, .related-grid .card:hover {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* --------- 썸네일 --------- */
.thumb-wrap {
    position: relative; overflow: hidden;
    background: var(--line-soft);
}
.thumb-main, .thumb-side, .thumb-list, .thumb-related {
    width: 100%; object-fit: cover; display: block;
    transition: transform .5s ease;
}
.thumb-main  { height: 520px; }
.thumb-side  { height: 250px; }
.thumb-list, .thumb-related { height: 220px; }
.card:hover .thumb-main,
.card:hover .thumb-side,
.card:hover .thumb-list,
.card:hover .thumb-related { transform: scale(1.04); }

.no-thumb { width: 100%; background: var(--line-soft); position: relative; }
.no-thumb.thumb-main { height: 520px; }
.no-thumb.thumb-side { height: 250px; }
.no-thumb.thumb-list, .no-thumb.thumb-related { height: 220px; }
.no-thumb:before {
    content: "NO IMAGE";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--ink-muted); font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.2em;
}

/* 히어로 오버레이 */
.overlay {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 28px; color: #fff;
    background: linear-gradient(to top,
        rgba(26,22,20,.92) 0%,
        rgba(26,22,20,.65) 40%,
        rgba(26,22,20,0) 100%);
}
.overlay h2, .overlay h3 {
    margin: 0 0 10px; color: #fff;
    letter-spacing: -0.025em; font-weight: 700;
    line-height: 1.3;
}
.overlay h2 { font-size: 32px; }
.overlay h3 { font-size: 22px; line-height: 1.35; }
.overlay .meta { font-size: 13px; opacity: .85; font-weight: 400; }

/* --------- 리스트 카드 --------- */
.post-list, .related-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 36px 28px;
}
.card-content, .related-content { padding: 18px 6px 10px; }
.card-content h3, .related-content h4 {
    margin: 0 0 10px; font-size: 18px; line-height: 1.4;
    font-weight: 600; letter-spacing: -0.02em; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card:hover .card-content h3,
.card:hover .related-content h4 { color: var(--accent-ink); }
.card-content .meta, .related-content .meta {
    font-size: 12.5px; color: var(--ink-muted); font-weight: 500;
    letter-spacing: -0.005em;
}
.post-list .card .thumb-wrap,
.related-grid .card .thumb-wrap { border-radius: var(--radius-sm); }

/* --------- 페이지네이션 --------- */
.pagination {
    display: flex; flex-wrap: wrap; gap: 4px;
    justify-content: center; margin-top: 56px;
}
.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 14px;
    border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--ink-soft);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all .15s; text-decoration: none;
    font-variant-numeric: tabular-nums;
}
.page-link:hover { background: var(--chip-bg); color: var(--ink); }
.page-link.is-active {
    background: var(--ink); color: #fff; border-color: var(--ink);
    font-weight: 600;
}
.page-dots {
    display: inline-flex; align-items: center;
    padding: 0 4px; color: var(--ink-muted);
}

/* --------- 빈 결과 --------- */
.empty-state {
    text-align: center; padding: 72px 20px; color: var(--ink-soft);
    background: var(--surface); border: 1px dashed var(--line);
    border-radius: var(--radius-md); margin-top: 16px;
}
.empty-state strong {
    display: block; color: var(--ink); font-size: 17px;
    margin-bottom: 6px; font-weight: 600; letter-spacing: -0.02em;
}
.empty-state span { font-size: 14px; color: var(--ink-muted); }

/* --------- 싱글 --------- */
.single-post { max-width: 760px; margin: 20px auto 0; }
.single-title {
    margin: 0 0 14px; font-size: 42px; line-height: 1.25;
    letter-spacing: -0.03em; font-weight: 700;
}
.single-meta {
    font-size: 14px; color: var(--ink-muted); margin-bottom: 32px;
    padding-bottom: 20px; border-bottom: 1px solid var(--line-soft);
}
.single-featured { margin: 0 0 36px; }
.single-featured img { width: 100%; border-radius: var(--radius-md); }
.single-content { font-size: 17px; line-height: 1.85; color: var(--ink); }
.single-content p { margin: 0 0 20px; }
.single-content h2 {
    font-size: 26px; margin: 44px 0 16px;
    letter-spacing: -0.025em; font-weight: 700;
}
.related-posts { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--line-soft); }

/* --------- 푸터 --------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: transparent; margin-top: 80px;
}
.site-footer-inner {
    max-width: 1240px; margin: 0 auto; padding: 32px 28px;
    text-align: center; color: var(--ink-muted); font-size: 13px;
}

/* --------- 반응형 --------- */
@media (max-width: 1024px) {
    .home-top { grid-template-columns: 1fr; }
    .home-side { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
    .post-list, .related-grid { grid-template-columns: repeat(2, 1fr); }
    .overlay h2 { font-size: 26px; }
    .overlay h3 { font-size: 18px; }
    .thumb-main { height: 420px; }
}

@media (max-width: 640px) {
    .site-wrap { padding: 0 20px; }
    .site-header-inner { flex-wrap: wrap; padding: 14px 20px; gap: 14px; }
    .site-search { min-width: 0; width: 100%; order: 3; }
    .home-side, .post-list, .related-grid { grid-template-columns: 1fr; }
    .thumb-main, .thumb-side, .thumb-list, .thumb-related,
    .no-thumb.thumb-main, .no-thumb.thumb-side, .no-thumb.thumb-list, .no-thumb.thumb-related {
        height: auto; aspect-ratio: 16 / 10;
    }
    .overlay h2 { font-size: 22px; }
    .overlay h3 { font-size: 17px; }
    .single-title { font-size: 30px; }
    .section-title { font-size: 22px; }
    .popular-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

