/*
Theme Name: Sumaplog Custom
Author: 수바나
Description: 미니멀 화이트 톤, 그린 포인트, 명조체를 활용한 브런치 스타일 에세이 테마
Version: 2.6 (모바일 목록/헤더 메뉴/페이지네이션/연관글 UI 개선)
*/

:root {
    --bg-color: #ffffff;
    --text-main: #333333;
    --text-light: #777777;
    --point-green: #4A7C59;
    --point-green-soft: #eef4f0;
    --border-soft: #ececec;
    --font-serif: 'Noto Serif KR', serif;
}

html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-serif);
    line-height: 1.6;
    word-break: keep-all;
}

a { color: inherit; text-decoration: none; transition: all 0.3s ease; }
a:hover { color: var(--point-green); }

/* Header */
.site-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 30px 0 18px;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    position: relative;
}

.site-logo {
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
    letter-spacing: 1px;
}

.site-nav { width: 100%; }

.menu-list {
    list-style: none !important;
    margin: 8px 0 0;
    padding: 12px 0 2px;
    display: flex;
    gap: 14px;
    border-top: 1px solid #f5f5f5;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.menu-list li {
    position: relative;
    list-style: none !important;
    white-space: nowrap;
}

/* PC Header 메뉴 스타일 개선 */
.menu-list > li > a {
    font-size: 14px;
    color: #4c4c4c;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 9px 16px;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #fff;
    transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, transform 0.2s ease;
}

.menu-list > li > a:hover,
.menu-list > li.current-menu-item > a,
.menu-list > li.current-menu-ancestor > a {
    color: var(--point-green);
    border-color: #dbe8df;
    background-color: var(--point-green-soft);
    transform: translateY(-1px);
}

.menu-list .sub-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #fff;
    min-width: 180px;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 999;
    list-style: none !important;
    margin: 0;
}

.menu-list .sub-menu li a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
}

.menu-list .sub-menu li a:hover { background: #f7faf8; }
.menu-list li:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* Detail */
.detail-main { max-width: 100% !important; margin: 0 auto !important; padding: 0 !important; }
.detail-header { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; margin-bottom: 60px; overflow: hidden; }
.detail-header.has-thumbnail { height: 480px; background-size: cover; background-position: center; }
.detail-header.has-thumbnail::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1; }
.detail-header.no-thumbnail { padding: 120px 0 80px; background-color: #fcfcfc; border-bottom: 1px solid #f0f0f0; }
.detail-header-inner { position: relative; z-index: 2; text-align: center; padding: 0 20px; max-width: 850px; }
.detail-title { font-size: 2.4rem; line-height: 1.35; margin-bottom: 15px; }
.has-thumbnail .detail-title { color: #fff !important; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }
.no-thumbnail .detail-title { color: var(--text-main) !important; font-weight: 700; }
.detail-meta { color: rgba(255, 255, 255, 0.9) !important; font-size: 0.95rem; }

.detail-content-wrapper {
    max-width: 740px !important;
    margin: 0 auto !important;
    padding: 0 20px;
    box-sizing: border-box;
}

.detail-content { font-size: 17.5px; line-height: 1.9; color: #333; }
.detail-content p { margin-bottom: 22px !important; }
.detail-content img { max-width: 100% !important; height: auto !important; margin: 45px auto !important; display: block; border-radius: 4px; }

/* 본문 링크는 hover 없이도 인지되도록 기본 밑줄/색상 적용 */
.detail-content a {
    color: var(--point-green);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.detail-content a:hover {
    color: #3f6a4d;
    text-decoration-thickness: 2px;
}

.detail-content form,
.detail-content .wpcf7 { max-width: 100%; margin: 0 auto; }

.detail-content input[type="text"],
.detail-content input[type="email"],
.detail-content textarea {
    width: 100% !important;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    box-sizing: border-box;
    font-family: inherit;
}

.detail-content input[type="submit"],
.detail-content .wp-block-button__link,
.detail-content .wp-element-button {
    background-color: var(--point-green);
    color: #fff !important;
    border: 1px solid var(--point-green);
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* 버튼 hover 시 색 대비를 유지하도록 더 밝은 톤으로 변경 */
.detail-content input[type="submit"]:hover,
.detail-content .wp-block-button__link:hover,
.detail-content .wp-element-button:hover {
    background-color: #5f8f6d;
    border-color: #5f8f6d;
    color: #ffffff !important;
}

/* Main list + pagination */
.site-main { max-width: 860px; margin: 56px auto; padding: 0 20px; }
.post-list-wrapper { display: flex; flex-direction: column; gap: 0; }
.post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    padding: 34px 0;
    gap: 34px;
}

.post-text-box { flex: 1; min-width: 0; }
.post-category { font-size: 13px; color: var(--point-green); font-weight: 700; }
.post-title { font-size: 1.45rem; margin: 10px 0 12px; line-height: 1.45; }
.post-excerpt { margin: 0 0 14px; color: #616161; }
.post-meta { color: #8a8a8a; font-size: 14px; }

.post-thumb-box { width: 160px; height: 160px; flex-shrink: 0; }
.post-thumb-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }

/* 페이지네이션 디자인 개선 */
.pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    color: #4f4f4f;
    font-weight: 600;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    border-color: var(--point-green);
    background: var(--point-green);
    color: #fff;
}

/* 연관 글 섹션 */
.related-posts-container {
    max-width: 940px;
    margin: 70px auto 0;
    padding: 0 20px;
}

.related-header-box {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.related-title-text { margin: 0; font-size: 1.3rem; }
.related-title-line { height: 1px; background: #ddd; flex: 1; }

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.related-card {
    border: 1px solid #ececec;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.related-card-thumb { aspect-ratio: 16 / 10; position: relative; overflow: hidden; }
.related-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f3f3;
    color: #888;
    font-size: 13px;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.related-card:hover .card-overlay { opacity: 1; }
.related-card-info { padding: 14px 14px 16px; }
.card-tag { font-size: 12px; color: var(--point-green); font-weight: 700; }
.card-title { margin: 8px 0 10px; font-size: 1rem; line-height: 1.45; }
.card-date { margin: 0; font-size: 13px; color: #8a8a8a; }

.site-footer { border-top: 1px solid #eaeaea; padding: 50px 0; text-align: center; margin-top: 80px; }
.footer-menu { display: flex; gap: 40px; justify-content: center; list-style: none; padding: 0; margin-bottom: 25px; }

.detail-content [class*="elementor-"] { width: 100% !important; max-width: 100% !important; padding: 0 !important; }
.hamburger-btn { display: none; background: none; border: none; cursor: pointer; }
.hamburger-btn span { display: block; width: 25px; height: 2px; background: #333; margin-bottom: 5px; }

/* Mobile list UI 개선 */
@media (max-width: 768px) {
    .detail-header.has-thumbnail { height: 350px; }
    .detail-header.no-thumbnail { padding: 80px 0 40px; }
    .detail-title { font-size: 1.8rem; }
    .hamburger-btn { display: block !important; position: absolute; top: 0; right: 20px; z-index: 1001; }

    .site-main { margin-top: 26px; padding: 0 16px; }

    .post-item {
        flex-direction: row;
        align-items: flex-start;
        gap: 14px;
        padding: 20px 0;
    }

    .post-title { font-size: 1.16rem; margin: 8px 0; }
    .post-excerpt {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 10px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .post-meta { font-size: 13px; }

    .post-thumb-box {
        width: 92px;
        height: 92px;
        border-radius: 10px;
        overflow: hidden;
    }

    .pagination { gap: 6px; margin-top: 30px; }
    .pagination .page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }

    .related-posts-container { margin-top: 52px; padding: 0 16px; }
    .related-grid { grid-template-columns: 1fr; gap: 14px; }

    /* 모바일에서 2열 이미지 그룹을 1열 세로 배치로 변환 */
    .detail-content .wp-block-gallery,
    .detail-content .blocks-gallery-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .detail-content .wp-block-gallery.has-nested-images {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .detail-content .wp-block-gallery .wp-block-image,
    .detail-content .blocks-gallery-item {
        width: 100% !important;
        margin: 0 !important;
    }

    .detail-content .wp-block-gallery .wp-block-image img,
    .detail-content .blocks-gallery-item img {
        width: 100% !important;
        height: auto !important;
    }

}
