/*
Theme Name: Alldaygift Lite
Theme URI: https://alldaygift.kr
Description: 기프트조아 판촉물 쇼핑몰 홍보용 경량 독립 테마. AEO/SEO/GEO 최적화, 멀티 도메인 첫페이지 템플릿 지원. wp-custom-post 플러그인과 세트로 동작 (panchokmool-lite 자매 테마).
Author: 웹웍스 / 호텔천사
Author URI: https://webworks.co.kr
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: alldaygift-lite
*/

/* =========================================================================
   1. 디자인 토큰 (:root)
   ========================================================================= */
:root {
    /* 색상 — 브랜드(기본 크림슨). 첫페이지 템플릿은 자체 팔레트로 override */
    --ag-primary:      #e84118;
    --ag-primary-dk:   #c0320f;
    --ag-accent:       #2563eb;
    --ag-text:         #1f2937;
    --ag-text-soft:    #4b5563;
    --ag-text-mute:    #6b7280;
    --ag-border:       #e5e7eb;
    --ag-border-soft:  #f1f3f5;
    --ag-bg:           #ffffff;
    --ag-bg-soft:      #f8fafc;
    --ag-bg-mute:      #f3f4f6;
    --ag-success:      #16a34a;
    --ag-danger:       #dc2626;

    /* 타이포 */
    --ag-font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    --ag-fs-caption: 13px;
    --ag-fs-label:   14px;
    --ag-fs-ui:      15px;
    --ag-fs-body:    16px;
    --ag-fs-lead:    18px;
    --ag-fs-h3:      20px;
    --ag-fs-h2:      24px;
    --ag-fs-h1:      clamp(28px, 4.5vw, 36px);

    /* 간격 */
    --ag-space-1: 4px;
    --ag-space-2: 8px;
    --ag-space-3: 12px;
    --ag-space-4: 16px;
    --ag-space-5: 24px;
    --ag-space-6: 32px;
    --ag-space-7: 48px;
    --ag-space-8: 64px;

    /* 레이아웃 */
    --ag-container:    1100px;
    --ag-container-rd: 760px;   /* 읽기 전용(single) 폭 */
    --ag-radius-sm: 6px;
    --ag-radius:    10px;
    --ag-radius-lg: 16px;
    --ag-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --ag-shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --ag-shadow-md: 0 6px 16px rgba(0,0,0,.08);
}

/* =========================================================================
   2. 리셋 & 기본
   ========================================================================= */
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; }
/* html body: specificity를 높여 wp-block-library global-styles의 body 폰트 override 방지 */
html body {
    margin: 0;
    font-family: var(--ag-font);
    font-size: var(--ag-fs-body);
    line-height: 1.7;
    color: var(--ag-text);
    background: var(--ag-bg);
    word-break: keep-all;
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; }
a { color: var(--ag-primary); text-decoration: none; }
a:hover { color: var(--ag-primary-dk); text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; color: var(--ag-text); margin: 1.6em 0 .6em; font-weight: 700; }
h1 { font-size: var(--ag-fs-h1); }
h2 { font-size: var(--ag-fs-h2); }
h3 { font-size: var(--ag-fs-h3); }
p  { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }

/* 접근성 */
.ag-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.ag-skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 1000;
    background: var(--ag-primary); color: #fff; padding: 10px 16px; border-radius: 0 0 6px 0;
}
.ag-skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--ag-accent); outline-offset: 2px; }

/* =========================================================================
   3. 레이아웃
   ========================================================================= */
.ag-container { width: 100%; max-width: var(--ag-container); margin: 0 auto; padding: 0 var(--ag-space-4); }
.ag-site-main { padding: var(--ag-space-6) 0 var(--ag-space-8); min-height: 50vh; }

/* =========================================================================
   4. 헤더 / 네비게이션
   ========================================================================= */
.ag-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,.96); backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--ag-border);
    /* 공용 셸: body(홈 템플릿이 시스템폰트로 덮어씀)의 폰트 상속을 끊고 Pretendard 고정 */
    font-family: var(--ag-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.ag-header-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--ag-space-4); height: 64px; }
.ag-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; color: var(--ag-text); }
.ag-brand:hover { text-decoration: none; color: var(--ag-primary); }
.ag-brand img { max-height: 38px; width: auto; }
.ag-nav { flex: 1 1 auto; min-width: 0; }
.ag-nav > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--ag-space-5); align-items: center; }
.ag-nav a { display: block; color: var(--ag-text-soft); font-size: var(--ag-fs-ui); font-weight: 500; white-space: nowrap; padding: 6px 0; }
.ag-nav a:hover { color: var(--ag-primary); text-decoration: none; }
.ag-nav .current-menu-item > a,
.ag-nav .current-menu-parent > a,
.ag-nav .current-menu-ancestor > a { color: var(--ag-primary); }
.ag-nav .sub-menu { list-style: none; margin: 0; padding: 0; }

/* 상위 항목 캐럿 (하위메뉴 있을 때) */
.ag-nav .menu-item-has-children > a { display: inline-flex; align-items: center; gap: 5px; }
.ag-nav .menu-item-has-children > a::after {
    content: ""; width: 6px; height: 6px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px); opacity: .55; transition: transform .15s ease;
}

/* ── 데스크톱: 호버 메가 드롭다운 (우측 정렬·가로 넓게) ── */
@media (min-width: 769px) {
    /* 메가 패널을 헤더 컨테이너(.ag-header-inner) 기준으로 우측 정렬 */
    .ag-nav > ul > .menu-item-has-children { position: static; }
    .ag-nav .menu-item-has-children:hover > a::after { transform: rotate(225deg) translateY(2px); }

    .ag-nav .sub-menu {
        position: absolute; z-index: 200;
        background: #fff; border: 1px solid var(--ag-border); border-radius: var(--ag-radius);
        box-shadow: var(--ag-shadow-md);
        opacity: 0; visibility: hidden; transform: translateY(6px);
        transition: opacity .15s ease, transform .15s ease, visibility .15s;
    }
    .ag-nav li:hover > .sub-menu,
    .ag-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }

    /* 1단 메가 패널: 헤더 우측, 가로로 넓게, 그룹을 컬럼으로 배치 */
    .ag-nav > ul > .menu-item-has-children > .sub-menu {
        top: calc(100% + 1px); right: 0; left: auto;
        width: min(880px, 94vw); max-height: 80vh; overflow-y: auto;
        padding: 20px 24px;
        display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 32px;
    }

    /* 그룹(2단, 하위 보유) = 컬럼 + 헤더 */
    .ag-nav > ul > .menu-item-has-children > .sub-menu > li.menu-item-has-children { flex: 0 0 auto; min-width: 150px; max-width: 200px; }
    .ag-nav > ul > .menu-item-has-children > .sub-menu > li.menu-item-has-children > a {
        font-weight: 700; color: var(--ag-text); font-size: var(--ag-fs-label);
        padding: 0 0 6px; margin-bottom: 6px; border-bottom: 2px solid var(--ag-primary); cursor: default;
    }
    .ag-nav > ul > .menu-item-has-children > .sub-menu > li.menu-item-has-children > a::after { display: none; }

    /* 그룹 하위(3단) = 정적 목록 */
    .ag-nav .sub-menu .sub-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        box-shadow: none; border: 0; border-radius: 0; padding: 0; width: auto;
        max-height: none; overflow: visible;
    }

    /* 그룹 없이 평면(2단만)인 경우: 항목들이 컬럼으로 흐르도록 */
    .ag-nav > ul > .menu-item-has-children > .sub-menu > li:not(.menu-item-has-children) { flex: 0 0 auto; min-width: 150px; }

    /* 항목 링크 */
    .ag-nav .sub-menu a { padding: 6px 8px; font-weight: 500; font-size: var(--ag-fs-label); border-radius: var(--ag-radius-sm); white-space: normal; color: var(--ag-text-soft); }
    .ag-nav .sub-menu a:hover { background: var(--ag-bg-soft); color: var(--ag-primary); }
}
.ag-header-actions { display: flex; align-items: center; gap: var(--ag-space-3); }
.ag-shop-link {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--ag-primary); color: #fff; font-size: var(--ag-fs-label); font-weight: 700;
    padding: 8px 16px; border-radius: 999px; white-space: nowrap;
}
.ag-shop-link:hover { background: var(--ag-primary-dk); color: #fff; text-decoration: none; }

/* 모바일 메뉴 토글 */
.ag-nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ag-text); }
@media (max-width: 768px) {
    .ag-nav-toggle { display: inline-flex; }
    .ag-nav {
        position: absolute; left: 0; right: 0; top: 64px;
        background: #fff; border-bottom: 1px solid var(--ag-border);
        max-height: 0; overflow: hidden auto; transition: max-height .25s ease;
    }
    .ag-nav.is-open { max-height: 80vh; }
    .ag-nav > ul { flex-direction: column; flex-wrap: nowrap; gap: 0; padding: var(--ag-space-2) var(--ag-space-4); align-items: stretch; }
    .ag-nav li { border-bottom: 1px solid var(--ag-border-soft); }
    .ag-nav a { padding: 12px 4px; }
    .ag-nav .menu-item-has-children > a { justify-content: space-between; }
    .ag-nav .menu-item-has-children > a::after { margin-left: auto; }
    /* 모바일: 드롭다운을 펼친 목록으로 표시 (호버 불가) */
    .ag-nav .sub-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        width: auto; max-width: none; column-width: auto; columns: auto;
        background: var(--ag-bg-soft); border: 0; border-radius: 0; box-shadow: none;
        max-height: none; overflow: visible; padding: 4px 0 8px 14px;
    }
    .ag-nav .sub-menu li { border-bottom: 0; }
    .ag-nav .sub-menu a { padding: 9px 6px; }
}

/* =========================================================================
   5. 글 목록 카드 (archive / index / search)
   ========================================================================= */
.ag-archive-head { margin-bottom: var(--ag-space-6); }
.ag-archive-head h1 { margin: 0 0 .3em; }
.ag-archive-desc { color: var(--ag-text-mute); margin: 0; }
.ag-card-grid {
    display: grid; gap: var(--ag-space-5);
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ag-card {
    display: flex; flex-direction: column; background: #fff;
    border: 1px solid var(--ag-border); border-radius: var(--ag-radius); overflow: hidden;
    transition: box-shadow .2s ease, transform .1s ease;
}
.ag-card:hover { box-shadow: var(--ag-shadow-md); transform: translateY(-2px); }
.ag-card-thumb { display: block; aspect-ratio: 16/10; background: var(--ag-bg-mute); overflow: hidden; }
.ag-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ag-card-thumb-ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #c4c9d0; }
.ag-card-body { display: flex; flex-direction: column; gap: var(--ag-space-2); padding: var(--ag-space-4); flex: 1; }
.ag-card-cat { font-size: var(--ag-fs-caption); font-weight: 700; color: var(--ag-primary); }
.ag-card-title { font-size: var(--ag-fs-h3); margin: 0; line-height: 1.4; }
.ag-card-title a { color: var(--ag-text); }
.ag-card-title a:hover { color: var(--ag-primary); text-decoration: none; }
.ag-card-excerpt { font-size: var(--ag-fs-label); color: var(--ag-text-mute); margin: 0; }
.ag-card-meta { margin-top: auto; font-size: var(--ag-fs-caption); color: var(--ag-text-mute); }

/* 페이지네이션 */
.ag-pagination { margin-top: var(--ag-space-7); }
.ag-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ag-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px;
    padding: 0 12px; border: 1px solid var(--ag-border); border-radius: var(--ag-radius-sm);
    color: var(--ag-text-soft); font-size: var(--ag-fs-label);
}
.ag-pagination .page-numbers.current { background: var(--ag-primary); border-color: var(--ag-primary); color: #fff; }
.ag-pagination a.page-numbers:hover { border-color: var(--ag-primary); color: var(--ag-primary); text-decoration: none; }

/* =========================================================================
   6. 싱글 글
   ========================================================================= */
.ag-single { max-width: 100%; margin: 0 auto; }
/* 본문(플러그인 주입 .prmX-post)의 860px 캡을 해제해 제목·네비와 같은 컨테이너 폭으로 채움 */
.ag-content [class^="prm"][class$="-post"] { max-width: 100%; }
.ag-breadcrumb { font-size: var(--ag-fs-caption); color: var(--ag-text-mute); margin-bottom: var(--ag-space-4); }
.ag-breadcrumb a { color: var(--ag-text-mute); }
.ag-breadcrumb a:hover { color: var(--ag-primary); }
.ag-single-title { margin: 0 0 var(--ag-space-4); }
.ag-single-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--ag-space-3);
    font-size: var(--ag-fs-label); color: var(--ag-text-mute);
    padding-bottom: var(--ag-space-4); margin-bottom: var(--ag-space-5);
    border-bottom: 1px solid var(--ag-border);
}
.ag-single-meta .ag-author { font-weight: 600; color: var(--ag-text-soft); }
.ag-single-thumb { margin: 0 0 var(--ag-space-5); border-radius: var(--ag-radius); overflow: hidden; }
.ag-content { font-size: var(--ag-fs-body); }
.ag-content img { border-radius: var(--ag-radius-sm); height: auto; }
.ag-content h2 { margin-top: 1.8em; }
.ag-content a { text-decoration: underline; }
.ag-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; }
.ag-content th, .ag-content td { border: 1px solid var(--ag-border); padding: 8px 12px; text-align: left; }
.ag-content blockquote {
    margin: 1.2em 0; padding: .6em 1.2em; border-left: 4px solid var(--ag-primary);
    background: var(--ag-bg-soft); color: var(--ag-text-soft);
}

/* 태그 */
.ag-single-tags { margin: var(--ag-space-6) 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ag-single-tags a {
    font-size: var(--ag-fs-caption); color: var(--ag-text-soft);
    background: var(--ag-bg-mute); padding: 5px 12px; border-radius: 999px;
}
.ag-single-tags a:hover { background: var(--ag-primary); color: #fff; text-decoration: none; }

/* 작성자 박스 (본문 하단 E-E-A-T) */
.ag-author-box {
    display: flex; gap: var(--ag-space-4); align-items: flex-start;
    margin: var(--ag-space-6) 0; padding: var(--ag-space-5);
    background: var(--ag-bg-soft); border: 1px solid var(--ag-border); border-radius: var(--ag-radius-lg);
}
.ag-author-avatar {
    flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
    background: var(--ag-primary); color: #fff; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.ag-author-info { flex: 1 1 auto; min-width: 0; }
.ag-author-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.ag-author-name { font-size: 16px; font-weight: 700; color: var(--ag-text); }
.ag-author-title { font-size: var(--ag-fs-caption); color: var(--ag-text-mute); }
.ag-author-bio { margin: 8px 0 10px; font-size: var(--ag-fs-label); line-height: 1.7; color: var(--ag-text-soft); }
.ag-author-more { font-size: var(--ag-fs-label); font-weight: 600; color: var(--ag-primary); text-decoration: none; }
.ag-author-more:hover { text-decoration: underline; }
.ag-author-posts { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ag-border); }
.ag-author-posts-head { margin: 0 0 8px; font-size: var(--ag-fs-caption); font-weight: 700; color: var(--ag-text); }
.ag-author-posts ul { list-style: none; margin: 0 0 10px; padding: 0; }
.ag-author-posts li { position: relative; margin: 0; padding: 4px 0; font-size: var(--ag-fs-label); line-height: 1.6; border-bottom: 1px dashed var(--ag-border); }
.ag-author-posts li:last-child { border-bottom: 0; }
.ag-author-posts li::before { content: "\203A"; position: absolute; left: 1px; top: 4px; color: var(--ag-primary); font-weight: 700; }
.ag-author-posts li a { color: var(--ag-text-soft); text-decoration: none; display: block; padding-left: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-author-posts li a:hover { color: var(--ag-primary); }

/* 글 네비게이션 */
.ag-post-nav { display: flex; gap: var(--ag-space-4); margin: var(--ag-space-6) 0; }
.ag-post-nav a { flex: 1; border: 1px solid var(--ag-border); border-radius: var(--ag-radius); padding: var(--ag-space-4); }
.ag-post-nav a:hover { border-color: var(--ag-primary); text-decoration: none; }
.ag-post-nav .ag-pn-label { font-size: var(--ag-fs-caption); color: var(--ag-text-mute); }
.ag-post-nav .ag-pn-title { display: block; color: var(--ag-text); font-weight: 600; margin-top: 4px; }
.ag-post-nav .next { text-align: right; }

/* =========================================================================
   7. 버튼 (공용)
   ========================================================================= */
.ag-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-size: var(--ag-fs-ui); font-weight: 700; line-height: 1; cursor: pointer;
    padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; min-height: 44px;
    transition: background-color .2s ease, transform .1s ease;
}
.ag-btn:active { transform: scale(.98); }
.ag-btn-primary { background: var(--ag-primary); color: #fff; }
.ag-btn-primary:hover { background: var(--ag-primary-dk); color: #fff; text-decoration: none; }
.ag-btn-outline { background: #fff; color: var(--ag-text); border-color: var(--ag-border); }
.ag-btn-outline:hover { border-color: var(--ag-primary); color: var(--ag-primary); text-decoration: none; }

/* =========================================================================
   8. 푸터
   ========================================================================= */
.ag-footer { background: #111827; color: #cbd5e1; margin-top: var(--ag-space-8); }
.ag-footer a { color: #cbd5e1; }
.ag-footer a:hover { color: #fff; }
.ag-footer-main { padding: var(--ag-space-7) 0; }
.ag-footer-grid { display: grid; gap: var(--ag-space-6); grid-template-columns: 1.4fr 1fr 1fr; }
.ag-footer-brand-name { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; color: #fff; }
.ag-footer-tagline { font-size: var(--ag-fs-label); color: #94a3b8; margin: var(--ag-space-3) 0 var(--ag-space-4); }
.ag-footer-col h2 { font-size: var(--ag-fs-ui); color: #fff; margin: 0 0 var(--ag-space-3); }
.ag-footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ag-footer-col a { font-size: var(--ag-fs-label); }
.ag-footer-company { border-top: 1px solid #1f2937; padding: var(--ag-space-4) 0; }
.ag-footer-company-line { margin: 2px 0; font-size: var(--ag-fs-caption); color: #94a3b8; line-height: 1.7; }
.ag-footer-company-line a { color: #cbd5e1; }
.ag-footer-company-line a:hover { color: #fff; }
.ag-footer-bottom { border-top: 1px solid #1f2937; padding: var(--ag-space-4) 0; }
.ag-footer-bottom-inner { display: flex; flex-wrap: wrap; gap: var(--ag-space-3); justify-content: space-between; align-items: center; }
.ag-footer-copy { font-size: var(--ag-fs-caption); color: #94a3b8; margin: 0; }
.ag-footer-legal { display: flex; gap: var(--ag-space-4); }
.ag-footer-legal a { font-size: var(--ag-fs-caption); }

@media (max-width: 768px) {
    .ag-footer-grid { grid-template-columns: 1fr; gap: var(--ag-space-5); }
    .ag-post-nav { flex-direction: column; }
}

/* =========================================================================
   9. 빈 상태 / 404
   ========================================================================= */
.ag-empty { text-align: center; padding: var(--ag-space-8) var(--ag-space-4); color: var(--ag-text-mute); }
.ag-empty h1 { font-size: var(--ag-fs-h2); color: var(--ag-text); margin-bottom: var(--ag-space-3); }
.ag-empty .ag-btn { margin-top: var(--ag-space-4); }

/* =========================================================================
   10. 모션 감소
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
