/* ONYOU Design Tokens */

/* Alpine FOUC 방지 — defer 로드~init 갭 동안 x-show 조건부 요소(모달·배너)가
   잠깐 보이는 깜빡임 차단. x-cloak 붙은 요소는 Alpine 이 init 하며 속성을 뗄 때까지 숨김. */
[x-cloak] { display: none !important; }

:root {
  /* Primary — sage green */
  --green-primary: #4A9B7F;
  --green-soft: #7DB89A;
  --green-bg-light: #E8F0E1;
  --green-mint: #D5EBE0;
  --green-deep: #3A7B63;

  /* Semantic Backgrounds */
  --bg-cream: #FFFBF5;
  --bg-peach: #FFE8E0;
  --bg-mint: #E8F0E1;
  --bg-apricot: #FFF0E0;
  --bg-pink: #FFE5EC;
  --bg-butter: #FFF4D6;
  --bg-lilac: #EFE8F5;

  /* Text */
  --text-primary: #2D2D2D;
  --text-secondary: #8B8B8B;
  --text-muted: #B8B8B8;

  /* Accents */
  --accent-coral: #F4A895;
  --accent-gold: #F5D491;
  --kakao-yellow: #FEE500;
  --kakao-text: #3C1E1E;

  /* Status */
  --status-success: #4A9B7F;
  --status-warning: #F4A895;
  --status-progress: #FFC9A8;
  --status-up: #E57373;
  --status-down: #6BA4D8;

  /* Border */
  --border-light: #F0E8DC;
  --border-soft: #E0D8CC;

  /* Radii */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-full: 999px;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 20px;
  --sp-2xl: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  /* PWA 폴리시(2026-05-28): 스탠드얼론에서 pull-to-refresh 와 바운스 스크롤 비활성 — 네이티브 앱 느낌. */
  overscroll-behavior-y: contain;
}
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--text-primary);
  background: #ECECEC;
  font-feature-settings: 'tnum';
  -webkit-font-smoothing: antialiased;
}

/* PWA 폴리시(2026-05-28, hotfix): 모든 button 에 눌림 효과. 탭바는 <a> 라 영향 X.
   `:where(button:not(:disabled))` 로 :not 까지 :where 안에 → specificity (0,1,0).
   Tailwind active:scale-95 (specificity 0,2,0) 가 있으면 그게 이김 → 박수 버튼 0.95 유지. */
:where(button:not(:disabled)):active {
  transform: scale(0.96);
  transition: transform 120ms ease;
}

/* Pretendard via CDN */
@font-face {
  font-family: 'Pretendard';
  font-weight: 400;
  src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/variable/woff2/PretendardVariable.woff2') format('woff2-variations');
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  font-weight: 500 900;
  src: url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/packages/pretendard/dist/web/variable/woff2/PretendardVariable.woff2') format('woff2-variations');
  font-style: normal;
  font-display: swap;
}

/* App-level type */
.t-hero { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.t-h1   { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.3; }
.t-h2   { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; }
.t-h3   { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.4; }
.t-body { font-size: 14px; font-weight: 400; line-height: 1.55; }
.t-body-strong { font-size: 14px; font-weight: 600; line-height: 1.5; }
.t-small { font-size: 12px; font-weight: 400; line-height: 1.45; color: var(--text-secondary); }
.t-caption { font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.t-micro { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }
.t-tnum { font-variant-numeric: tabular-nums; }

/* Card */
.card {
  background: #fff;
  border: 0.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

/* Button base */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  padding: 14px 20px; border-radius: 12px;
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
  min-height: 52px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green-primary); color: #fff; }
.btn-primary:active { background: var(--green-deep); }
.btn-secondary { background: #fff; color: var(--text-primary); border: 1px solid var(--border-soft); }
.btn-kakao { background: var(--kakao-yellow); color: var(--kakao-text); }
.btn-outline-green { background: #fff; color: var(--green-primary); border: 1.5px solid var(--green-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); min-height: auto; padding: 8px 12px; }
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 13px; border-radius: 10px; }

/* Chip */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #fff; color: var(--text-primary);
  border: 1px solid var(--border-soft);
}
.chip-active { background: var(--green-primary); color: #fff; border-color: var(--green-primary); }
.chip-mint { background: var(--bg-mint); color: var(--green-deep); border-color: transparent; }
.chip-peach { background: var(--bg-peach); color: #C96C4F; border-color: transparent; }
.chip-pink { background: var(--bg-pink); color: #C94F7A; border-color: transparent; }

/* Input */
.input {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px; font-family: inherit; color: var(--text-primary);
  outline: none;
}
.input:focus { border-color: var(--green-primary); box-shadow: 0 0 0 3px rgba(74,155,127,0.12); }

/* Utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }

/* scrollbar hide */
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* placeholder image */
.ph-img {
  position: relative;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0 6px, transparent 6px 12px),
    var(--bg-mint);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 10px;
  border-radius: 12px;
}

/* Bottom sheet overlay */
.sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: fadeIn 200ms ease;
}
.sheet {
  width: 100%;
  background: var(--bg-cream);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 28px;
  animation: slideUp 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes popSpring {
  0% { opacity: 0; transform: scale(0); }
  60% { opacity: 1; transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes sparkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(20deg); }
}
@keyframes cheerPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes confetti-fall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(700px) rotate(720deg); opacity: 0; }
}

/* progress bar */
.pbar {
  width: 100%; height: 6px; background: rgba(0,0,0,0.06);
  border-radius: 999px; overflow: hidden;
}
.pbar > div { height: 100%; background: var(--green-primary); border-radius: 999px; transition: width 400ms ease; }

/* donut */
.donut-wrap { position: relative; width: 60px; height: 60px; }
.donut { transform: rotate(-90deg); }
.donut circle { fill: none; stroke-linecap: round; }

/* 박수 버튼 펄스 (W3-04) */
.cheer-pop { animation: cheerPop 400ms ease; }

/* tab bar */
.tabbar {
  height: 72px; background: #fff; border-top: 0.5px solid var(--border-light);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px 14px;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-muted); cursor: pointer;
  font-size: 10px; font-weight: 500;
  transition: color 120ms;
}
.tab[data-active="true"] { color: var(--green-primary); font-weight: 700; }
.tab svg { width: 22px; height: 22px; }

/* avatar */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; flex-shrink: 0;
  background: var(--green-soft);
}
.avatar-40 { width: 40px; height: 40px; font-size: 14px; }
.avatar-32 { width: 32px; height: 32px; font-size: 12px; }
.avatar-56 { width: 56px; height: 56px; font-size: 18px; }
.avatar-120 { width: 120px; height: 120px; font-size: 42px; }

/* badge */
.badge-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-butter); color: #B5852B;
  font-size: 10px; font-weight: 700;
}

/* legal pages — 약관/개인정보 처리방침 typography (2026-05-28). */
.legal-content h2 { font-size: 1.05rem; font-weight: 700; margin-top: 1.5rem; color: var(--text-primary); }
.legal-content h3 { font-size: 0.95rem; font-weight: 600; margin-top: 1rem; color: var(--text-primary); }
.legal-content p { margin-top: 0.5rem; line-height: 1.6; }
.legal-content ol { margin-top: 0.5rem; padding-left: 1.5rem; list-style: decimal; }
.legal-content ul { margin-top: 0.5rem; padding-left: 1.5rem; list-style: disc; }
.legal-content li { margin-top: 0.25rem; line-height: 1.55; }
.legal-content table { width: 100%; margin-top: 0.75rem; border-collapse: collapse; font-size: 0.8rem; border: 1px solid #d1d5db; }
.legal-content th, .legal-content td { border: 1px solid #d1d5db; padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.legal-content th { background: #f3f4f6; font-weight: 600; }
.legal-content .article-num { font-weight: 700; }

/* senior-mode scaler (tweak) */
.senior-mode { --type-scale: 1.18; }
.senior-mode .t-body { font-size: calc(14px * var(--type-scale, 1)); }
.senior-mode .t-h3 { font-size: calc(15px * var(--type-scale, 1)); }

/* screen transitions */
.screen-enter { animation: screenIn 280ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes screenIn { from { opacity: 0; transform: translateX(8%); } to { opacity: 1; transform: translateX(0); } }

/* dashed outline */
.dashed {
  border: 1.5px dashed var(--border-soft);
}
