/* =====================================================================
   assets/css/layout.css - 화면 뼈대 (헤더, 분류 줄, 모바일 메뉴, 본문, 푸터, 하단 탭)
   모바일 우선: 기본 스타일 = 휴대폰, @media (min-width: 900px) = PC
   ===================================================================== */

.pw-container { width: 100%; max-width: var(--pw-container); margin: 0 auto; padding: 0 16px; }

/* ---------- 헤더 ---------- */
.pw-header { background: var(--pw-surface); border-bottom: 1px solid var(--pw-border); }
.pw-header-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "logo bell menu" "search search search";
    align-items: center;
    gap: 10px 12px;
    padding-top: 10px; padding-bottom: 12px;
}
.pw-logo { grid-area: logo; display: inline-flex; align-items: center; gap: 9px; color: var(--pw-text);
           font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-decoration: none !important; }
.pw-logo img { width: 34px; height: 34px; }
.pw-logo.is-custom img { width: auto; max-width: 160px; object-fit: contain; }   /* 올린 로고 (v2.2.1) - 가로로 긴 로고 */
.pw-footer-brand img.is-custom { width: auto; max-width: 140px; object-fit: contain; }
@media (max-width: 380px) { .pw-logo.is-custom img { max-width: 120px; } }
@media (min-width: 768px) { .pw-logo.is-custom img { max-width: 220px; } }
.pw-search { grid-area: search; display: flex; height: 44px; border: 1.5px solid var(--pw-border-strong);
             border-radius: 12px; background: #fff; position: relative; }
.pw-search:focus-within { border-color: var(--pw-brand); box-shadow: 0 0 0 3px rgba(196, 101, 42, .15); }
.pw-search input { flex: 1; min-width: 0; border: 0; padding: 0 14px; background: transparent; font-size: 15px; }
.pw-search input:focus { outline: none; }
.pw-search button { width: 48px; border: 0; background: transparent; color: var(--pw-brand-strong); cursor: pointer; }
.pw-header-links { display: none; }

/* 알림 종 (통합 v1.5.0) - 모바일은 햄버거 왼쪽, PC 는 오른쪽 메뉴 안 */
.pw-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
           border-radius: 10px; font-size: 19px; text-decoration: none !important; }
.pw-bell-m { grid-area: bell; border: 1px solid var(--pw-border); background: #fff; }
.pw-bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
                 background: #d2453a; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }

/* 햄버거 버튼 (모바일) */
.pw-menu-btn { grid-area: menu; width: 42px; height: 42px; border: 1px solid var(--pw-border); border-radius: 10px;
               background: #fff; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
               gap: 4px; cursor: pointer; }
.pw-menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--pw-text); }

/* ---------- 사이트 영역 줄 (통합 v1.1.0: 홈 · 위키 · 우리집 아이 · 커뮤니티 · 공지) ---------- */
.pw-sitenav { border-top: 1px solid var(--pw-border); background: #fff; }
.pw-sitenav-inner { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding-top: 2px; padding-bottom: 0; }
.pw-sitenav-inner::-webkit-scrollbar { display: none; }
.pw-sitenav a { flex: none; padding: 9px 14px 8px; color: var(--pw-text-2); font-size: 15px; font-weight: 700; white-space: nowrap;
                text-decoration: none !important; border-bottom: 3px solid transparent; }
.pw-sitenav a:hover { color: var(--pw-text); }
.pw-sitenav a.is-active { color: var(--pw-brand-strong); border-bottom-color: var(--pw-brand); }
.pw-drawer-links .pw-drawer-label { margin: 12px 0 4px; }

/* ---------- 위키 분류 줄 (위키 영역에서만, 모바일은 옆으로 밀어서 보기) ---------- */
.pw-catbar { border-top: 1px solid var(--pw-border); background: var(--pw-surface); }
.pw-catbar-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 6px; }
.pw-catbar-inner::-webkit-scrollbar { display: none; }
.pw-catbar a { flex: none; padding: 6px 12px; border-radius: 8px; color: var(--pw-text-2); font-size: 14px;
               font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.pw-catbar a:hover { background: var(--pw-surface-2); color: var(--pw-text); }
.pw-catbar a.is-active, .pw-catbar-all { color: var(--pw-brand-strong) !important; }
.pw-catbar-all { background: var(--pw-brand-soft); }

/* ---------- 모바일 전체 메뉴 (드로어) ---------- */
.pw-drawer[hidden] { display: none; }
.pw-drawer { position: fixed; inset: 0; z-index: 300; }
.pw-drawer-backdrop { position: absolute; inset: 0; background: rgba(30, 20, 10, .4); }
.pw-drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); background: var(--pw-surface);
                   overflow-y: auto; padding: 16px 16px 32px; box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
                   animation: pwSlideIn .2s ease-out; }
@keyframes pwSlideIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pw-drawer-panel { animation: none; } }
.pw-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pw-drawer-close { width: 38px; height: 38px; border: 0; border-radius: 8px; background: var(--pw-surface-2); cursor: pointer; font-size: 16px; }
.pw-drawer-account { display: grid; gap: 8px; margin-bottom: 18px; }
.pw-drawer-me-actions { display: flex; gap: 8px; justify-content: flex-end; }
.pw-drawer-me-actions form { margin: 0; }
.pw-drawer-links a, .pw-drawer-cats a { display: flex; align-items: center; gap: 10px; padding: 11px 6px;
    border-bottom: 1px solid var(--pw-border); color: var(--pw-text); text-decoration: none !important; }
.pw-drawer-label { margin: 22px 0 4px; font-size: 13px; font-weight: 700; color: var(--pw-muted); }
.pw-drawer-cats a span { width: 22px; text-align: center; }
body.pw-no-scroll { overflow: hidden; }

/* ---------- 본문 ---------- */
.pw-main { padding: 18px 0 calc(var(--pw-tabbar-h) + 32px + env(safe-area-inset-bottom)); min-height: 60vh; }

/* ---------- 푸터 ---------- */
.pw-footer { border-top: 1px solid var(--pw-border); background: var(--pw-surface);
             padding: 26px 0 calc(var(--pw-tabbar-h) + 26px + env(safe-area-inset-bottom)); color: var(--pw-text-2); font-size: 14px; }
.pw-footer-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--pw-text); }
.pw-footer-notice { background: var(--pw-health-soft); color: #20605e; border-radius: var(--pw-radius-sm); padding: 10px 12px; }
.pw-footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0; }
.pw-footer-links a { color: var(--pw-text-2); }
.pw-footer-copy { color: var(--pw-muted); font-size: 13px; margin: 0; }

/* ---------- 모바일 하단 탭 ---------- */
.pw-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 200; display: grid; grid-template-columns: repeat(5, 1fr);
             height: calc(var(--pw-tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
             background: rgba(255, 255, 255, .97); border-top: 1px solid var(--pw-border);
             box-shadow: 0 -2px 10px rgba(60, 40, 20, .05); }
.pw-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
               font-size: 11.5px; font-weight: 600; color: var(--pw-muted); text-decoration: none !important; }
.pw-tabbar a span { font-size: 20px; line-height: 1.1; filter: grayscale(.4); }
.pw-tabbar a.is-active { color: var(--pw-brand-strong); }
.pw-tabbar a.is-active span { filter: none; }

/* =====================================================================
   PC (900px 이상)
   ===================================================================== */
@media (min-width: 900px) {
    .pw-container { padding: 0 24px; }
    .pw-header { position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 0 rgba(0, 0, 0, .02); }
    .pw-header-inner { display: flex; gap: 20px; min-height: var(--pw-header-h); padding-top: 8px; padding-bottom: 8px; }
    .pw-search { flex: 1 1 auto; max-width: 520px; height: 42px; }
    .pw-header-links { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 14.5px; white-space: nowrap; }
    .pw-header-links a:not(.pw-btn) { color: var(--pw-text-2); font-weight: 600; }
    .pw-header-links a:not(.pw-btn):hover { color: var(--pw-text); }
    .pw-menu-btn { display: none; }
    .pw-bell-m { display: none; }
    .pw-header-links .pw-bell { width: 36px; height: 36px; }
    .pw-catbar-inner { padding-top: 4px; padding-bottom: 4px; }
    .pw-main { padding: 28px 0 56px; }
    .pw-footer { padding-bottom: 32px; }
    .pw-footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 4px 32px; }
    .pw-footer-notice { grid-column: 1 / -1; }
    .pw-tabbar { display: none; }
}

/* 헤더 메뉴가 많아 좁은 PC 화면에서는 덜 중요한 메뉴를 숨김 (모바일 메뉴에는 그대로 있음) */
@media (min-width: 900px) and (max-width: 1179px) {
    .pw-header-links .pw-hl-opt { display: none; }
    .pw-header-links { gap: 12px; }
}

/* ---------- 검색창 자동 완성 (⑤ v0.5.0) ---------- */
.pw-suggest-host { position: relative; }
.pw-suggest { position: absolute; z-index: 300; top: calc(100% + 6px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px 0;
              background: #fff; border: 1px solid var(--pw-border-strong); border-radius: 12px;
              box-shadow: 0 8px 28px rgba(60, 40, 20, .14); max-height: 60vh; overflow-y: auto; text-align: left; }
.pw-suggest li a { display: flex; align-items: baseline; gap: 8px; padding: 9px 14px; color: var(--pw-text); text-decoration: none; font-size: 15px; }
.pw-suggest li.is-active a, .pw-suggest li a:hover { background: var(--pw-brand-soft); }
.pw-suggest-title b { color: var(--pw-brand-strong); }
.pw-suggest-to { font-size: 13px; color: var(--pw-muted); }
.pw-suggest-more { border-top: 1px solid var(--pw-border); margin-top: 4px; }
.pw-suggest-more a { color: var(--pw-link) !important; font-size: 14px !important; }
