/* app.css — 소담 앱 화면 부품
   값은 tokens.css의 변수만 쓴다. 부품 이름은 피그마 Components 이름을 따른다(주석에 피그마 이름).
   화면 크기: 아이폰 393 × 852. PC에서는 휴대폰 틀 안에, 실제 휴대폰에서는 화면 가득. */

/* ---------- 바탕 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-font-family);
  color: var(--text-title-neutral-900);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
}
::selection { background: var(--primary-100); color: var(--text-title-neutral-900); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; }
:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 2px; border-radius: 8px; }
/* 시트가 열릴 때 제목으로 옮기는 초점은 화면 읽기 프로그램용이라 테두리를 그리지 않는다 */
[data-sheet-title]:focus { outline: none; }

/* ---------- 휴대폰 틀 ---------- */
body.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--neutral-200);
}
.device {
  --status-h: 59px;
  position: relative;
  width: 393px;
  height: 852px;
  overflow: hidden;
  border-radius: 52px;
  background: var(--background-neutral-50);
  box-shadow: 0 0 0 10px var(--neutral-950), 0 40px 80px -24px rgba(58, 52, 46, 0.45);
  isolation: isolate;
}
/* 미리보기 그림(index의 작은 화면)용: 틀 없이 */
body.app.is-bare { padding: 0; background: transparent; display: block; }
body.app.is-bare .device { border-radius: 0; box-shadow: none; }
/* 실제 휴대폰: 화면 가득, 가짜 상태 표시줄 숨김 */
@media (max-width: 500px) {
  body.app:not(.is-bare) { padding: 0; display: block; background: var(--background-neutral-50); }
  body.app:not(.is-bare) .device { width: 100%; height: 100dvh; border-radius: 0; box-shadow: none; --status-h: max(16px, env(safe-area-inset-top, 0px)); }
  body.app:not(.is-bare) .device .status-bar { display: none; }
}

/* ---------- 상태 표시줄 (StatusBar · iOS) ---------- */
.status-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 30;
  height: 59px;
  display: flex; align-items: flex-end;
  pointer-events: none;
}
.status-bar__time {
  flex: 1; display: flex; justify-content: center;
  padding: 0 0 3px 10px; height: 100%; align-items: center;
  font-family: var(--font-system); font-size: 16px; font-weight: 600; letter-spacing: -0.32px; color: var(--base-black);
}
.status-bar__island { width: 125px; }
.status-bar__icons { flex: 1; display: flex; justify-content: center; align-items: center; height: 100%; padding-right: 11px; }

/* ---------- 화면 스크롤 영역 ---------- */
.screen {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-top: var(--status-h);
  padding-bottom: 136px; /* 하단 탭 높이 + 여유 */
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen__body { display: flex; flex-direction: column; gap: var(--space-s-xl); padding: 0 var(--space-s-s); }
.group { display: flex; flex-direction: column; gap: var(--space-s-2xs); }

/* 머리말: 로고 (Header Logo) */
.app-header { display: flex; align-items: center; height: 28px; margin: 8px 0 12px; padding-left: 32px; }
.logo { position: relative; width: 45.5px; height: 28px; overflow: hidden; }
.logo img { position: absolute; max-width: none; width: 633.87%; height: 2242.11%; left: -35.48%; top: -252.63%; }

/* ---------- 구간 머리 (예정된 일정 · 가족 프로필) ---------- */
.section-head { display: flex; align-items: center; gap: 4px; padding-left: 8px; }
.section-head__label { flex: 1; display: flex; align-items: center; gap: 6px; color: var(--neutral-500); }
.section-head__label img { width: 16px; height: 16px; }

/* 작은 버튼 (Button · Small, neutral) — 추가 + / 편집 */
.btn-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  height: 32px; padding: 4px 8px; border-radius: 12px;
  background: var(--background-neutral-100); color: var(--text-body-neutral-600);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.btn-chip > span { padding: 0 4px; }
.btn-chip img { width: 16px; height: 16px; }
.btn-chip--primary { background: var(--background-primary-50); color: var(--primary-base); }
.btn-chip:active { transform: scale(0.96); background: var(--neutral-200); }
.btn-chip--primary:active { background: var(--primary-100); }

/* ---------- 카드 (User Details) ---------- */
.card { background: var(--base-white); border: 1px solid var(--stroke-neutral-200); border-radius: var(--radius-r-l); }
.card--lg { border-radius: var(--radius-r-xl); }
.pressable { transition: transform var(--dur-fast) var(--ease-out); }
.pressable:active { transform: scale(0.98); }

/* 예정된 일정 줄 */
.schedule { display: flex; align-items: center; width: 100%; padding: 12px 8px; text-align: left; }
.schedule__date { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 16px; }
.schedule__month { color: var(--text-caption-neutral-400); }
.schedule__divider { align-self: stretch; width: 1px; background: var(--stroke-neutral-200); }
.schedule__info { flex: 1; min-width: 0; padding-left: 16px; display: flex; flex-direction: column; }
.schedule__info p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule__time { color: var(--text-body-neutral-600); }
.icon-24 { width: 24px; height: 24px; flex: none; }

/* ---------- 다음 단계 카드 ---------- */
.steps { display: flex; flex-direction: column; gap: 12px; padding: 24px 8px 8px; overflow: hidden; }
.steps__head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.steps__head-label { color: var(--neutral-500); }
.count-badge { padding: 4px 12px; border-radius: 12px; background: var(--primary-50); color: var(--primary-base); font-variant-numeric: tabular-nums; }
.steps__list { padding: 0 16px; }
.steps__more-list { overflow: hidden; }
.steps__more-list[hidden] { display: none; }

/* 할 일 한 줄 (to do list) */
.todo { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--stroke-neutral-100); }
.todo__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.todo__cat { display: flex; align-items: center; gap: 4px; color: var(--primary-base); }
.todo__cat--box { gap: 8px; }
.todo__cat-icon { width: 14px; height: 14px; }
.todo__cat-box { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--primary-50); }
.todo__text { color: var(--text-title-neutral-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--dur-base) var(--ease-move); }
.todo.is-done .todo__text { color: var(--text-caption-neutral-400); }

/* 체크박스 (Checkbox · Check&Radio) — 자주 누르는 것이라 움직임은 누름 반응만 */
.checkbox { position: relative; display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -4px -4px 0; border-radius: 10px; }
.checkbox img { width: 24px; height: 24px; transition: transform var(--dur-fast) var(--ease-out); }
.checkbox:active img { transform: scale(0.88); }
.checkbox .is-on { position: absolute; opacity: 0; }
.todo.is-done .checkbox .is-on { opacity: 1; }
.todo.is-done .checkbox .is-off { opacity: 0; }

/* 더보기 버튼 (Button · Ghost) */
.btn-more-wrap { padding: 0 16px; }
.btn-more {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  width: 100%; height: 36px; border-radius: 12px; color: var(--text-caption-neutral-400);
}
.btn-more img { width: 20px; height: 20px; transition: transform var(--dur-base) var(--ease-move); }
.btn-more[aria-expanded="true"] img { transform: rotate(180deg); }
.btn-more:active { background: var(--background-neutral-50); }

/* ---------- 가족 프로필 타일 ---------- */
.profiles { display: flex; gap: var(--space-s-2xs); }
.profile-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px;
  border-radius: var(--radius-r-l); background: var(--base-white); border: 1px solid var(--stroke-neutral-200);
  color: var(--text-body-neutral-700);
}
.profile-tile--add { background: var(--background-neutral-100); border-color: transparent; color: var(--text-body-neutral-600); }
.profile-tile--add .avatar { background: none; box-shadow: none; }

/* 프로필 동그라미 */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--base-white); box-shadow: var(--shadow-float);
}
.avatar--40 { width: 40px; height: 40px; }
.avatar--secondary { background: var(--secondary-base); }
.avatar--primary { background: var(--primary-400); }
.avatar--warning { background: var(--warning-300); }
.avatar--info { background: var(--info-300); }
.avatar--negative { background: var(--negative-400); }
.avatar--blue { background: #527ba8; } /* 피그마에 변수 없이 직접 입력된 색 — 정리 대기 */

/* ---------- 하단 탭 (Bottom Bar · BottomMenu) ---------- */
.tabbar {
  position: absolute; inset: auto 0 0 0; z-index: 20;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 16px max(28px, env(safe-area-inset-bottom, 0px));
  background: var(--background-neutral-50);
}
.tabbar__menu { flex: 1; display: flex; align-items: center; padding: 12px 8px; border-radius: 32px; background: var(--base-white); box-shadow: var(--shadow-float); }
.tab { flex: 1; display: flex; justify-content: center; padding: 4px; border-radius: 12px; }
.tab__inner { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 48px; }
.tab__inner img { width: 24px; height: 24px; transition: transform var(--dur-fast) var(--ease-out); }
.tab:active img { transform: scale(0.9); }
.tab__label { font-size: 11px; font-weight: var(--weight-semibold); line-height: 16px; color: var(--text-body-neutral-600); } /* 11px: 글자 스타일 밖 값 — 정리 대기 */
.tabbar__record {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 76px; height: 76px; flex: none; border-radius: 32px;
  background: var(--primary-base); color: var(--base-white); box-shadow: var(--shadow-float);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.tabbar__record img { width: 24px; height: 24px; }
.tabbar__record:active { transform: scale(0.95); background: var(--primary-600); }
.tabbar__record-label { font-size: 12px; font-weight: var(--weight-bold); line-height: 16px; }

/* ---------- 시트 (아래에서 올라오는 창) ---------- */
.sheet-layer { position: absolute; inset: 0; z-index: 40; visibility: hidden; }
.sheet-layer.is-open { visibility: visible; }
.sheet-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); opacity: 0; } /* 피그마 시트 화면의 값 — Dimed 변수(20%)와 다름, 정리 대기 */
.sheet {
  position: absolute; inset: auto 0 0 0;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius-r-l) var(--radius-r-l) 0 0;
  background: var(--base-white);
  transform: translateY(100%);
  touch-action: none;
}
.sheet__grab { display: flex; justify-content: center; width: 100%; padding-top: 12px; cursor: grab; }
.sheet__grab span { width: 48px; height: 4px; border-radius: 20px; background: var(--stroke-neutral-200); }
.sheet__title { width: 100%; padding: 20px 20px 0; }
.sheet__body { width: 100%; padding: 16px 20px; }
.sheet__foot { width: 100%; padding: 20px 16px 16px; }

/* 목록 줄 (List Item · 프로필) */
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 0; border-bottom: 1px solid var(--stroke-neutral-100); text-align: left; }
.list-row__user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.list-row__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.list-row__sub { color: var(--text-body-neutral-600); }

/* 태그 (Tag) */
.tag { padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag--secondary { background: var(--secondary-50); color: var(--secondary-500); }
.tag--neutral { background: var(--background-neutral-50); color: var(--text-body-neutral-600); }

/* 큰 버튼 (Button · Large, neutral) */
.btn-lg {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  width: 100%; height: 56px; padding: 4px 24px; border-radius: var(--radius-r-m);
  background: var(--neutral-100); color: var(--neutral-700);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.btn-lg > span { padding: 0 4px; }
.btn-lg img { width: 20px; height: 20px; }
.btn-lg:active { transform: scale(0.98); background: var(--neutral-200); }

/* ---------- 알림 문구 (Snackbar) ---------- */
.snackbar {
  position: absolute; left: 16px; right: 16px; bottom: 128px; z-index: 50;
  padding: 14px 16px; border-radius: var(--radius-r-m);
  background: var(--neutral-900); color: var(--base-white);
  opacity: 0; pointer-events: none;
}

/* ---------- 움직임 줄이기 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
