/* 
 * Damoe Premium Design System
 * -----------------------------
 * 1. Global Reset & Typography
 * 2. Header (Sticky & Glassmorphism)
 * 3. Body & Post Layout (Cards)
 * 4. Micro Animations & Buttons
 */

/* 1. Global Reset & Typography */
:root {
    --damoe-bg: #f8f9fa;
    --damoe-surface: #ffffff;
    --damoe-text-main: #222222;
    --damoe-text-muted: #666666;
    --damoe-primary: #3b82f6;
    /* 토스 블루 느낌 */
    --damoe-primary-hover: #2563eb;
    --damoe-border: #eaeaea;
    --damoe-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    background-color: var(--damoe-bg) !important;
    color: var(--damoe-text-main) !important;
    line-height: 1.8;
    letter-spacing: -0.5px;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Pretendard', sans-serif !important;
    font-weight: 700 !important;
    color: var(--damoe-text-main) !important;
    letter-spacing: -0.8px;
    line-height: 1.4;
}

/* 2. Custom Header (Sticky, Center-focused, Thin) */
.damoe-custom-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--damoe-border);
    height: 65px;
    display: flex;
    align-items: center;
}

.damoe-header-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.damoe-header-left {
    flex: 1;
}

.damoe-header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.damoe-header-logo a {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--damoe-primary);
    text-decoration: none;
    letter-spacing: -1px;
}

.damoe-header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.damoe-header-search {
    width: 240px;
}

.damoe-header-search form {
    display: flex;
    position: relative;
}

.damoe-header-search input {
    width: 100%;
    padding: 8px 15px;
    padding-right: 40px;
    border: 1px solid var(--damoe-border);
    border-radius: 20px;
    background: #f1f5f9;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--damoe-text-main);
}

.damoe-header-search input:focus {
    outline: none;
    border-color: var(--damoe-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.damoe-header-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    color: var(--damoe-primary);
    font-size: 1rem;
}

/* Hide default theme header */
header.wp-block-template-part,
.wp-block-header,
#header {
    display: none !important;
}

/* 3. Body & Post Layout (Cards) */
/* 메인 콘텐츠 영역 (Post Grid 등) */
main {
    max-width: 1200px !important;
    margin: 40px auto !important;
    padding: 0 20px;
}

/* 포스트 리스트 카드 디자인 */
.wp-block-post {
    background: var(--damoe-surface) !important;
    border-radius: 16px !important;
    box-shadow: var(--damoe-shadow) !important;
    padding: 30px !important;
    margin-bottom: 40px !important;
    border: 1px solid var(--damoe-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wp-block-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
}

.wp-block-post-title {
    margin-top: 15px !important;
    margin-bottom: 10px !important;
}

.wp-block-post-title a {
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.wp-block-post-title a:hover {
    color: var(--damoe-primary) !important;
}

/* 단일 포스트 뷰 본문 컨테이너 */
.single-post main .wp-block-post {
    max-width: 850px !important;
    margin: 40px auto !important;
    padding: 50px 60px !important;
}

/* 4. AI Post Content Tweaks (alignwide) */
.alignwide {
    max-width: 100% !important;
}

.brunch-style-post p,
.alignwide p {
    margin-bottom: 26px !important;
    line-height: 1.85 !important;
    color: #333333 !important;
}

/* 이미지 및 캡션 여백 최적화 */
.brunch-style-post figure,
.alignwide figure {
    margin: 45px 0 35px 0 !important;
    text-align: center;
}

.brunch-style-post img,
.alignwide img {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: block;
    margin: 0 auto !important;
    max-width: 100%;
    height: auto;
}

.brunch-style-post figcaption,
.alignwide figcaption {
    font-size: 14px !important;
    color: var(--damoe-text-muted) !important;
    margin-top: 12px !important;
}

.brunch-style-post h2,
.alignwide h2 {
    font-size: 26px !important;
    margin-top: 50px !important;
    margin-bottom: 20px !important;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--damoe-text-main);
}

.brunch-style-post h3,
.alignwide h3 {
    font-size: 22px !important;
    margin-top: 40px !important;
    margin-bottom: 15px !important;
}

.brunch-style-post blockquote,
.alignwide blockquote {
    border-left: 5px solid var(--damoe-primary) !important;
    background: #f1f5f9 !important;
    padding: 20px 25px !important;
    margin: 30px 0 !important;
    border-radius: 0 8px 8px 0;
    font-style: normal !important;
    color: var(--damoe-text-main) !important;
}

/* Buttons & Links */
a {
    color: var(--damoe-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.ai-cta-btn {
    display: inline-block;
    background-color: var(--damoe-primary) !important;
    color: white !important;
    padding: 15px 30px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
}

.ai-cta-btn:hover {
    background-color: var(--damoe-primary-hover) !important;
    transform: scale(1.02);
    text-decoration: none !important;
}

/* Footer */
footer.wp-block-template-part {
    background-color: #111 !important;
    color: #fff !important;
    padding: 40px 0 !important;
    margin-top: 80px !important;
    text-align: center;
}

footer a {
    color: #aaa !important;
}

/* 푸터 워드프레스 기본 저작권 문구 강제 숨김 */
.wp-block-site-generator,
footer p:last-child {
    display: none !important;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .single-post main .wp-block-post {
        padding: 30px 20px !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
}

/* 5. Front Page Layout (Hero, Grid, Sidebar) */
.damoe-front-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.damoe-hero-section {
    margin-top: 40px;
    margin-bottom: 50px;
}
.damoe-hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    height: 500px;
}
.hero-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.hero-item-large {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}
.hero-item-small {
    grid-column: 2 / 3;
}
.hero-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}
.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 70%);
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: background 0.3s ease;
}
.hero-item:hover .hero-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.1) 70%);
}
.hero-content {
    color: #fff;
}
.hero-cat {
    display: inline-block;
    background: var(--damoe-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.hero-title {
    color: #fff !important;
    margin: 0 !important;
    font-size: 1.8rem !important;
}
.hero-item-small .hero-title {
    font-size: 1.2rem !important;
}

/* Main Container (Content + Sidebar) */
.damoe-main-container {
    display: flex;
    gap: 40px;
    margin-bottom: 60px;
}
.damoe-content-area {
    flex: 1;
    min-width: 0;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}
.damoe-sidebar {
    width: 320px;
    flex-shrink: 0;
}
.sticky-wrapper {
    position: sticky;
    top: 100px; /* Below the sticky header */
}

/* Trending Grid */
.section-header {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--damoe-text-main);
    padding-bottom: 10px;
}
.section-title {
    font-size: 1.2rem !important;
    margin: 0 !important;
}
.trending-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}
.trending-card {
    padding: 0 !important;
    overflow: hidden;
    margin-bottom: 0 !important;
}
.card-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.card-content {
    padding: 20px;
}
.card-cat {
    color: var(--damoe-primary);
    font-weight: 700;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}
.card-title {
    font-size: 1.2rem !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}
.card-excerpt {
    font-size: 0.95rem;
    color: var(--damoe-text-muted);
}

/* Sidebar Widgets */
.sidebar-widget {
    padding: 25px !important;
    margin-bottom: 30px !important;
}
.author-avatar {
    text-align: center;
    margin-bottom: 15px;
}
.author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--damoe-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.author-name {
    text-align: center;
    font-size: 1.3rem !important;
    margin-bottom: 10px !important;
}
.author-desc {
    font-size: 0.95rem;
    color: var(--damoe-text-muted);
    text-align: center;
    line-height: 1.6;
}

.must-read-widget .widget-title {
    margin-bottom: 20px !important;
    font-size: 1.2rem !important;
}
.must-read-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.must-read-list li {
    margin-bottom: 15px;
}
.must-read-list a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}
.mr-thumb img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}
.mr-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--damoe-text-main);
    line-height: 1.4;
    transition: color 0.2s;
}
.must-read-list a:hover .mr-title {
    color: var(--damoe-primary);
}

/* Responsive adjustments for Front Page */
@media (max-width: 992px) {
    .damoe-main-container {
        flex-direction: column;
    }
    .damoe-sidebar {
        width: 100%;
    }
    .sticky-wrapper {
        position: static;
    }
}
@media (max-width: 768px) {
    .damoe-hero-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    .hero-item-large, .hero-item-small {
        grid-column: 1 / -1;
        grid-row: auto;
        height: 250px;
    }
    .trending-grid {
        grid-template-columns: 1fr;
    }
}

/* 6. Latest Posts Feed */
.latest-feed-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.latest-card {
    display: flex;
    align-items: center;
    background: var(--damoe-surface);
    border: 1px solid var(--damoe-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0 !important;
}
.latest-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}
.latest-thumb {
    width: 250px;
    height: 180px;
    flex-shrink: 0;
}
.latest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.latest-info {
    padding: 25px;
    flex: 1;
}
.latest-tag {
    display: inline-block;
    color: var(--damoe-primary);
    background: #f0f4ff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.latest-title {
    font-size: 1.25rem !important;
    margin: 0 0 10px 0 !important;
}
.latest-title a {
    color: var(--damoe-text-main);
    text-decoration: none;
}
.latest-title a:hover {
    color: var(--damoe-primary);
}
.latest-excerpt {
    color: var(--damoe-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
}
.latest-date {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* 7. Tag Cloud Widget */
.damoe-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.damoe-tag-chip {
    display: inline-block;
    padding: 6px 14px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.damoe-tag-chip:hover {
    background: var(--damoe-primary);
    color: #fff;
    border-color: var(--damoe-primary);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .latest-card {
        flex-direction: column;
    }
    .latest-thumb {
        width: 100%;
        height: 200px;
    }
}