/* 캐릭터 랜드 화면 크기별 배치 (모든 페이지 공통)
   선택자에 .fixed/.relative 를 붙인 것은 Tailwind 클래스보다 우선시키기 위해서입니다. */

/* 아이폰 노치·다이내믹 아일랜드, 하단 홈 바에 본문이 가리지 않게 */
body > main.relative {
  padding-top: calc(4rem + env(safe-area-inset-top, 0px));
  padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

/* 태블릿 */
@media (min-width: 700px) {
  body #characterCardGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* PC */
@media (min-width: 1024px) {
  body > header > div,
  body > main > div {
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
  }

  /* 하단 메뉴를 상단 머리글 가운데로 */
  body > nav.fixed {
    top: 0;
    bottom: auto;
    left: 50%;
    width: auto;
    transform: translateX(-50%);
    z-index: 60;
    padding-bottom: 0;
    background: transparent;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body > nav.fixed > div { gap: 0.25rem; }
  body > nav.fixed a {
    flex-direction: row;
    gap: 0.375rem;
    padding: 0 0.875rem;
    border-radius: 9999px;
  }
  body > nav.fixed a:hover,
  body > nav.fixed a[aria-current="page"] { background: rgb(var(--c-primary-fixed)); }
  body > main.relative { padding-bottom: 2.5rem; }

  body #characterCardGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* 브랜드 · 트렌드 카드 2단 */
  body > main > div:has(> .brand-card) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  body > main > div:has(> .brand-card) > section { grid-column: 1 / -1; }
  body > main > div > section:has(> article:not(.character-card)):not(#treasureList) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body > main > div > section:has(> article) > div:first-child { grid-column: 1 / -1; }

  /* 보물 목록 2단 */
  body #treasureList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 좁은 폰: 머리글의 '보물 등록'은 아이콘만 (테마 버튼 자리) */
@media (max-width: 439px) {
  body > header a[data-path="register-treasure"] { width: 2.75rem; padding: 0; justify-content: center; }
  body > header a[data-path="register-treasure"] > span:not(.material-symbols-outlined) { display: none; }
}
@media (max-width: 359px) {
  body > header > div { gap: 0.25rem; padding-left: 0.75rem; padding-right: 0.75rem; }
  body > header .tracking-tight { font-size: 15px; white-space: nowrap; }
  body > header .animate-pulse { display: none; }
  body > header div.rounded-full:has(> .tracking-tight) { padding-left: 0.5rem; padding-right: 0.5rem; }
}

/* 어른을 위한 테마: 모서리를 덜 둥글게 */
html[data-adult] .rounded-lg { border-radius: 1rem; }
html[data-adult] .rounded-xl { border-radius: 1.25rem; }
html[data-adult] .rounded { border-radius: 0.625rem; }

/* 읽기 · 누르기 편하게 (모든 화면 크기) */
body { word-break: keep-all; overflow-wrap: break-word; }

/* 가장 작은 글자 키우기: 10px → 11px, 11px → 12px */
body .text-\[10px\] { font-size: 11px; }
body .text-\[11px\],
body .text-label-sm { font-size: 12px; line-height: 16px; }

/* 누르는 곳은 가로·세로 44px 이상. 아이콘 단추는 음수 여백으로 배치를 유지 */
body .filter-chip,
body .brand-filter-btn,
body #sortSelect,
body #reaction-buttons button,
body main div.p-1.rounded-full > button { min-height: 2.75rem; }
body #reaction-buttons button { min-width: 2.75rem; justify-content: center; }
body .heart-toggle { width: 2.75rem; height: 2.75rem; margin: -0.375rem; }
body .brand-heart-btn { width: 2.75rem; height: 2.75rem; flex-shrink: 0; }
body #treasureList button[aria-label="즐겨찾기"] {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.75rem; min-height: 2.75rem; margin: -0.5625rem -0.75rem;
}
body #treasureList div.justify-between.pt-1 > button { min-height: 2.75rem; }
body main a.self-end.underline { display: inline-flex; align-items: center; min-height: 2.75rem; }

/* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대하므로 맞춰 준다 */
@media (pointer: coarse) {
  /* :not(#_) 는 글자 크기 클래스보다 우선시키기 위한 것 */
  body :is(input, select, textarea):not(#_) { font-size: 16px; }
}
