/* responsive.css — 반응형 */

/* ════════════════════════════════════════
   PC 기준값 (≥1024px)
   - site-sidebar: 240px fixed
   - site-main: margin-left 240px, flex-1
   - page-container: max-width 720px, padding 28px 24px
════════════════════════════════════════ */

/* ════════════════════════════════════════
   태블릿 + 모바일 (≤1023px)
   사이드바 숨기고 상단 헤더 + 하단 탭바로 전환
════════════════════════════════════════ */
/* 헤더 앱설치 버튼 — 모바일 전용 */
.site-header__install-btn {
  display: none; /* 기본 숨김, 모바일에서만 표시 */
}

@media (max-width: 1023px) {
  .site-sidebar { display: none; }
  /* 사이드바 내 설치 버튼은 모바일에서 확실히 숨김 */
  .sidebar__util-btn#sb-pwa-btn { display: none !important; }

  .site-header__install-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
  }
  .site-header__install-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }

  .site-header {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    height: 56px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border-light);
    z-index: 50;
  }

  .bottom-nav { display: flex; }

  .page-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 16px calc(60px + env(safe-area-inset-bottom, 0) + 16px);
  }

  .site-footer__inner {
    max-width: 100%;
    margin: 0 auto;
  }

  /* 2컬럼 레이아웃 단일 컬럼 */
  .layout-cols { grid-template-columns: 1fr; }
  .layout-sidebar { display: none; }

  /* 어드민 */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── 푸터: 모바일에서 copy-bar만 표시 ── */
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
  .site-footer__mobile { display: none; }
}

[data-theme="dark"] .site-header {
  background: rgba(15,17,23,0.96);
  border-bottom-color: var(--color-border);
}

/* ════════════════════════════════════════
   모바일 (≤767px)
════════════════════════════════════════ */
@media (max-width: 767px) {
  .site-header { height: 52px; }
  .site-header__inner { padding: 0 14px; }

  .page-container {
    padding: 16px 14px calc(64px + env(safe-area-inset-bottom, 0) + 8px);
  }

  /* ── 홈 대시보드 모바일 ── */
  .home-dash { gap: 20px; }

  .home-hero {
    padding: 22px 18px 20px;
    border-radius: 16px;
    min-height: 200px;
  }
  .home-hero::after { display: none; }
  .home-hero__title { font-size: 20px; line-height: 1.25; }
  .home-hero__sub { font-size: 12px; margin-top: 8px; }
  .home-hero__actions { gap: 8px; margin-top: 16px; }
  .home-hero__actions .btn { font-size: 13px; padding: 9px 16px; }
  .home-hero__streak,
  .home-hero__badge { font-size: 11px; padding: 4px 11px; margin-bottom: 8px; }
  .home-hero__cta-btn { font-size: 13px; padding: 10px 20px; }
  .home-hero__ghost-btn { font-size: 13px; padding: 9px 16px; }

  /* 섹션 헤더 */
  .home-section-header { margin-bottom: 10px; }
  .home-section-title { font-size: 14px; }
  .home-section-sub { font-size: 11px; }

  /* 통계: 3열 유지, 컴팩트 */
  .home-stat-row { gap: 8px; }
  .home-stat-card { padding: 12px 8px; border-radius: 10px; }
  .home-stat-card__num { font-size: 18px; }
  .home-stat-card__label { font-size: 10px; margin-top: 4px; }

  /* 카테고리 카드: 세로 스택 → 가로 스크롤 */
  .home-cat-grid {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 10px;
    padding: 2px 0 8px;
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
    grid-template-columns: unset;
  }
  .home-cat-grid::-webkit-scrollbar { display: none; }
  .home-cat-card {
    flex-shrink: 0;
    width: 160px;
    border-radius: 12px;
  }
  .home-cat-card__desc { display: none; }

  /* 빠른 시작: 모바일 3열 2줄 */
  .home-quick-grid { gap: 8px; grid-template-columns: repeat(3, 1fr); }
  .home-quick-btn { padding: 12px 6px 10px; min-height: 72px; border-radius: 10px; }
  .home-quick-btn__icon { font-size: 20px; }
  .home-quick-btn__label { font-size: 11px; }

  /* 오늘의 소소한 질문 */
  .home-daily { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  .home-daily__q { white-space: normal; font-size: 13px; }
  .home-daily__btn { align-self: flex-end; }


  /* 랭킹 */
  .home-rank-item { padding: 10px 12px; }
  .home-rank-item__num { width: 24px; height: 24px; font-size: 11px; border-radius: 6px; }
  .home-rank-item__title { font-size: 12px; }
  .home-rank-item__type { font-size: 10px; }
  .home-rank-item__stats { font-size: 10px; gap: 6px; }

  /* 미션 배너 */
  .home-mission-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }
  .home-mission-banner__word { font-size: 22px; }
  .home-mission-banner__right {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }

  /* 푸터 모바일: 1열 */
  .site-footer__inner {
    grid-template-columns: 1fr;
    padding: 24px 14px 16px;
    gap: 16px;
  }
  .site-footer__copy-bar { padding: 12px 14px; }

  /* 피드 카드 */
  .feed-card.card {
    border-radius: 10px;
    border: 1.5px solid var(--color-border-light);
    box-shadow: var(--shadow-xs);
  }
  .feed-card__title { font-size: var(--font-size-base); }
  .feed-card__thumb { width: 70px; height: 70px; }

  /* 섹션 헤더 */
  .section-header { padding: 0; }
  .section-title { font-size: var(--font-size-base); }

  /* 모달 → 바텀 시트 */
  .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* 작성 */
  .write-page { max-width: 100%; }
  .type-select-grid { grid-template-columns: repeat(2, 1fr); }

  /* 어드민 */
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card__body--lg { padding: var(--space-4); }
}

/* ── 소형 모바일 (≤375px) ── */
@media (max-width: 375px) {
  .home-cat-card { width: 145px; }
  .home-quick-btn__label { font-size: 9px; }
  .feed-filters { gap: var(--space-1); }
  .filter-chip { padding: 5px var(--space-2); font-size: 10px; }
}

/* ── 전역 기본 ── */
* { min-width: 0; }
img { max-width: 100%; }
.page-container { overflow-x: hidden; }
