/* ============================================================
   ddoksun_platform.css  v5
   레이아웃 공통 스타일 (헤더/네비/푸터/래퍼)
   v5 변경: CSS 변수 추가, 스크롤 헤더 JS 분리
   ============================================================ */

/* ── CSS 변수 ──────────────────────────────────────────────── */
:root {
    --ddp-accent:      #1a73e8;
    --ddp-accent-dark: #1558b0;
    --ddp-bg:          #f8f8f8;
    --ddp-header-h:    60px;
    --ddp-max-w:       1180px;   /* ★ 전체 통일 기준 너비 */
    --ddp-pad-x:       24px;      /* ★ 전체 통일 기준 좌우 여백 */
    --ddp-pad-x-mob:   18px;      /* ★ 모바일 좌우 여백 */
    --ddp-radius:      6px;
    --ddp-font:        'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--ddp-font);
    font-size: 16px;
    line-height: 1.7;
    color: #222;
    background: var(--ddp-bg);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ── Layout Container ─────────────────────────────────────── */
.ddp-container {
    max-width: var(--ddp-max-w);
    margin: 0 auto;
    padding: 0 var(--ddp-pad-x); /* ★ 헤더·네비·본문 정렬선 통일 */
}

/* ── Header ───────────────────────────────────────────────── */
.ddp-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    transition: box-shadow .2s;
}
.ddp-header--scrolled { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.ddp-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--ddp-header-h);
    max-width: var(--ddp-max-w);
    margin: 0 auto;
    padding: 0 var(--ddp-pad-x); /* ★ .ddp-container 와 동일 */
}

/* 로고 */
.ddp-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ddp-accent);
    white-space: nowrap;
    flex-shrink: 0;
}
.ddp-logo:hover { text-decoration: none; opacity: .85; }
.ddp-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 헤더 breadcrumb */
.ddp-breadcrumb {
    flex: 1;
    overflow: hidden;
}
.ddp-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: .82rem;
    color: #666;
}
.ddp-breadcrumb ol li a { color: var(--ddp-accent); }
.ddp-breadcrumb ol li a:hover { text-decoration: underline; }
.ddp-bc-sep { color: #bbb; user-select: none; }

/* 햄버거 버튼 */
.ddp-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.ddp-menu-toggle span {
    display: block;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: .25s;
}
.ddp-menu-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ddp-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.ddp-menu-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Internal Nav (지역/업종 내비) ────────────────────────── */
.ddp-internal-nav {
    background: #f0f4ff;
    border-bottom: 1px solid #dce6ff;
}
.ddp-internal-nav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    max-width: var(--ddp-max-w);
    margin: 0 auto;
    padding: 10px var(--ddp-pad-x); /* ★ .ddp-container 와 동일 */
}
.ddp-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ddp-nav-label {
    font-size: .78rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}
.ddp-nav-icon { margin-right: 2px; }
.ddp-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ddp-nav-item {
    display: inline-block;
    padding: 3px 10px;
    font-size: .8rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #c8d8ff;
    color: #3a5fc8;
    transition: background .15s, color .15s;
}
.ddp-nav-item:hover { text-decoration: none; }
.ddp-nav-item:hover,
.ddp-nav-active {
    background: var(--ddp-accent) !important;
    border-color: var(--ddp-accent) !important;
    color: #fff !important;
}

/* ── Feed Header (랜딩 h1 + 소개문) ──────────────────────── */
.ddp-feed-header {
    padding: 32px 0 24px;
}
.ddp-feed-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: #111;
    line-height: 1.35;
    margin-bottom: 8px;
}
.ddp-feed-intro {
    font-size: .97rem;
    color: #555;
    max-width: 620px;
}

/* ── Main ─────────────────────────────────────────────────── */
.ddp-main {
    min-height: 60vh;
    padding: 0 0 60px;
}

/* ── Footer ───────────────────────────────────────────────── */
.ddp-footer {
    background: #1e2533;
    color: #aab;
    padding: 40px 0 28px;
    font-size: .88rem;
}
.ddp-footer-related {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 40px;
    margin-bottom: 28px;
}
.ddp-footer-col-title {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: #ccd;
    margin-bottom: 8px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.ddp-footer-col ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ddp-footer-col ul li a {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255,255,255,.06);
    color: #99a;
    font-size: .8rem;
    transition: background .15s, color .15s;
}
.ddp-footer-col ul li a:hover,
.ddp-footer-active {
    background: rgba(255,255,255,.14) !important;
    color: #fff !important;
    text-decoration: none;
}
.ddp-footer-copy {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 20px;
    color: #778;
    font-size: .82rem;
}

/* ── Scroll → 헤더 그림자 (JS inline) ────────────────────── */

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .ddp-menu-toggle { display: flex; }
    .ddp-breadcrumb  { display: none; }
    /* ★ 모바일: 헤더·컨테이너·네비 좌우 여백 동시 축소 → 정렬선 유지 */
    .ddp-header-inner       { padding: 0 var(--ddp-pad-x-mob); }
    .ddp-container          { padding: 0 var(--ddp-pad-x-mob); }
    .ddp-internal-nav-inner { padding: 8px var(--ddp-pad-x-mob); gap: 8px 16px; }
    .ddp-feed-title  { font-size: 1.35rem; }
    .ddp-footer      { padding: 28px 0 20px; }
    .ddp-footer-related { gap: 16px 24px; }
}
@media (max-width: 480px) {
    .ddp-feed-title { font-size: 1.2rem; }
    .ddp-nav-list   { gap: 4px; }
    .ddp-nav-item   { padding: 2px 8px; font-size: .75rem; }
}

/* ══════════════════════════════════════════════════════════
   최신글 자동 카드 섹션  (.ddp-latest-*)
   — layout.html 의 ddoksun_latest_posts 블록 전용
   — 3열 그리드 → 태블릿 2열 → 모바일 1열 (반응형)
   ══════════════════════════════════════════════════════════ */

/* 섹션 래퍼 */
.ddp-latest {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid #e8ecf4;
}

/* 섹션 헤더 */
.ddp-latest-header {
    margin-bottom: 20px;
}
.ddp-latest-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -.01em;
}

/* 카드 그리드 */
.ddp-latest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 카드 단위 */
.ddp-lc {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e4e8f0;
    overflow: hidden;
    transition: box-shadow .18s, transform .18s;
}
.ddp-lc:hover {
    box-shadow: 0 4px 20px rgba(26,115,232,.13);
    transform: translateY(-2px);
}

/* 카드 링크 — 전체 영역 클릭 */
.ddp-lc-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none !important;
}

/* 썸네일 래퍼 — 1:1 정사각형 고정 */
.ddp-lc-thumb-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 비율 */
    overflow: hidden;
    background: #f0f2f7;
    flex-shrink: 0;
}

/* 실제 썸네일 이미지 */
.ddp-lc-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s;
}
.ddp-lc:hover .ddp-lc-thumb {
    transform: scale(1.04);
}

/* 기본 이미지 플레이스홀더 */
.ddp-lc-thumb-ph {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ddp-lc-ph-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.4rem;
    opacity: .35;
}

/* 카드 텍스트 영역 */
.ddp-lc-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

/* 제목 */
.ddp-lc-title {
    font-size: .97rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.45;
    /* 2줄 말줄임 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 요약 */
.ddp-lc-exc {
    font-size: .83rem;
    color: #666;
    line-height: 1.55;
    /* 3줄 말줄임 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── 반응형 ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .ddp-latest-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}
@media (max-width: 540px) {
    .ddp-latest {
        margin-top: 28px;
        padding-top: 24px;
    }
    .ddp-latest-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    /* 모바일: 가로형 카드 (썸네일 왼쪽 + 텍스트 오른쪽) */
    .ddp-lc-link {
        flex-direction: row;
        align-items: flex-start;
    }
    .ddp-lc-thumb-wrap {
        width: 96px;
        padding-top: 96px; /* 정사각형 유지 */
        flex-shrink: 0;
    }
    .ddp-lc-body {
        padding: 10px 12px;
        gap: 4px;
    }
    .ddp-lc-title {
        font-size: .93rem;
    }
    .ddp-lc-exc {
        -webkit-line-clamp: 2;
    }
}

/* searchdoc logo alignment fix */
.ddp-logo {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

.ddp-logo-img {
    display: block !important;
    height: 34px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

.ddp-logo-text {
    display: block !important;
    font-size: 30px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    color: #1267e8 !important;
    letter-spacing: -0.8px !important;
    margin-top: 1px !important;
}

/* use full horizontal logo only */
.ddp-logo-text {
    display: none !important;
}

.ddp-logo-img {
    height: 42px !important;
    width: auto !important;
}

/* searchdoc header left alignment fix */
.ddp-header,
.ddp-topbar {
    width: 100% !important;
}

.ddp-header-inner,
.ddp-topbar-inner {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding-left: 40px !important;
    padding-right: 40px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
}

.ddp-logo {
    margin-left: 0 !important;
}

/* searchdoc header position rebalance */
.ddp-header-inner,
.ddp-topbar-inner {
    max-width: 520px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

.ddp-logo {
    margin-left: 0 !important;
}

/* searchdoc header align to hero left line */
.ddp-header-inner,
.ddp-topbar-inner {
    max-width: 1280px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
}

.ddp-logo {
    margin-left: 0 !important;
}

/* searchdoc naver-style carousel for landing pages */
.searchdoc-latest-carousel-section {
    margin: 34px 0 38px;
}

.searchdoc-naver-carousel {
    margin: 18px 0 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.searchdoc-naver-carousel ul {
    display: flex;
    gap: 16px;
    padding: 4px 2px 16px;
    margin: 0;
    list-style: none;
}

.searchdoc-naver-carousel .item {
    flex: 0 0 180px;
}

.searchdoc-naver-carousel .item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.searchdoc-naver-carousel .thumb {
    width: 180px;
    height: 120px;
    border-radius: 18px;
    overflow: hidden;
    background: #eef4ff;
    box-shadow: 0 10px 26px rgba(15, 35, 80, .10);
}

.searchdoc-naver-carousel .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.searchdoc-naver-carousel .thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 14px;
    font-weight: 800;
}

.searchdoc-naver-carousel .title {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    color: #111827;
    word-break: keep-all;
}

@media (max-width: 768px) {
    .searchdoc-naver-carousel .item {
        flex-basis: 150px;
    }

    .searchdoc-naver-carousel .thumb {
        width: 150px;
        height: 100px;
        border-radius: 15px;
    }

    .searchdoc-naver-carousel .title {
        font-size: 13px;
    }
}

/* searchdoc main about-footer spacing */
.dd-about,
.ddp-about,
.dd-main-about,
section[aria-label="서치닥 소개"] {
    padding-bottom: 88px !important;
}

.dd-footer {
    margin-top: 0 !important;
    padding-top: 64px !important;
    padding-bottom: 54px !important;
}

.dd-footer-inner {
    padding-top: 0 !important;
}

@media (max-width: 768px) {
    .dd-about,
    .ddp-about,
    .dd-main-about,
    section[aria-label="서치닥 소개"] {
        padding-bottom: 64px !important;
    }

    .dd-footer {
        padding-top: 52px !important;
        padding-bottom: 46px !important;
    }
}
