/**
 * atJeju — 앱 shell (header, main, tabbar, safe-area, PC 중앙 정렬)
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
}

/* 앱 루트 — 모바일 기본 (데스크탑은 desktop.css) */
.app-shell {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: var(--app-max-width);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

/* RN WebView — PC용 body 패딩 제거, safe-area는 웹 탭바·헤더가 처리 */
html.in-webview body {
  padding: 0;
}

html.in-webview .app-shell {
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
  min-height: 100dvh;
}

@media (min-width: 768px) {
  html.in-webview .app-tabbar {
    max-width: 100%;
  }
}

/* 상단 고정 헤더 — 모든 페이지 */
.app-header,
.app-header--global {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  flex-shrink: 0;
  padding-top: var(--safe-top);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
  padding: var(--space-2) var(--space-4);
  padding-left: calc(var(--space-4) + var(--safe-left));
  padding-right: calc(var(--space-4) + var(--safe-right));
}

.app-header__inner--with-back .brand {
  font-size: var(--font-size-base);
}

.app-header__inner--with-back .search-bar {
  align-self: center;
}

/* 스크롤 메인 — 탭바 높이만큼 하단 여백 */
.app-main {
  flex: 1;
  overflow-x: hidden;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--space-4));
}

/* 하단 고정 탭바 — 모든 페이지 */
.app-tabbar,
.app-tabbar--global {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-tabbar);
  width: 100%;
  max-width: var(--app-max-width);
  padding-bottom: var(--safe-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.app-tabbar__inner {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: var(--tabbar-h);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.app-tabbar__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-2) 0;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  min-height: 44px;
  transition: color 0.15s ease;
}

.app-tabbar__link.is-active {
  color: var(--color-primary);
  font-weight: 600;
}

.app-tabbar__icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* 페이지 공통 */
.page {
  padding: var(--space-4);
}

.section {
  margin-bottom: var(--space-6);
}

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section__title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.section__more {
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  font-weight: 500;
}
