/* ==========================================================================
   GrowLog — Base
   디자인 토큰 · 기본 타이포그래피 · 공통 유틸리티
   색상은 원본 GrowLog 디자인 토큰(frontend/src/styles/tokens.css)을 기준으로 잡았다.
   - 주색: 원본 Primary Green #3F7D63 (흰 글자 대비 4.9:1)
   - 배경 · 면 · 테두리: 원본 Warm Neutral #F7F8F5 · #FFFFFF · #E5E9E1
   - 글자: 원본 #222824, 보조 글자는 원본 #727872 를 4.5:1 이 되도록 조금 진하게
   - 보조색: 원본 Accent #C9D7A8 (히트맵 · 장식)
   - 상태색: 원본처럼 브랜드와 분리 — 완료(success) 초록, 진행 중(warning) 주황
   ========================================================================== */

:root {
  /* Color — Surface */
  --c-bg: #f7f8f5;
  --c-surface: #ffffff;
  --c-surface-2: #eef1eb;
  --c-line: #e5e9e1;
  --c-line-strong: #cfd6cb;

  /* Color — Text (모두 --c-bg 위에서 4.5:1 이상) */
  --c-ink: #222824;
  --c-ink-2: #4d554f;
  --c-ink-3: #667068;

  /* Color — Brand */
  --c-primary: #3f7d63;          /* 버튼 · 활성 · 성장 강조 (위 글자는 --c-on-primary) */
  --c-primary-hover: #35694f;
  --c-primary-soft: #ddebe3;
  --c-primary-text: #35694f;     /* 밝은 면 위 초록 글자 6.0:1 */
  --c-on-primary: #ffffff;
  --c-accent: #c9d7a8;
  --c-deep: #142c22;             /* 원본 랜딩의 짙은 초록 — 어두운 패널 */

  /* Color — Semantic (브랜드와 분리) */
  --c-success: #16a34a;
  --c-success-soft: #e9f7f0;
  --c-success-text: #15803d;
  --c-warning-soft: #fef3e2;
  --c-warning-text: #b45309;
  --c-danger: #b91c1c;
  --c-danger-hover: #991b1b;
  --c-danger-soft: #fdecea;
  --c-muted-soft: #eceee9;
  --c-muted-text: #474e49;

  /* Color — Category */
  --c-rose-soft: #fde8ea;
  --c-rose-text: #9f1d35;
  --c-sky-soft: #e2f0fb;
  --c-sky-text: #1e5a8a;

  /* Heatmap (기록 수 0 → 3+) — 원본 성장 단계 primary-bg → accent → primary → primary-hover */
  --c-heat-0: #e6eae2;
  --c-heat-1: #c9d7a8;
  --c-heat-2: #7ba788;
  --c-heat-3: #35694f;

  --c-focus: #2563eb;
  --c-overlay: rgb(20 28 24 / 0.45);
  --c-scrim: rgb(20 44 34 / 0.75);

  /* Typography */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --fs-xs: 0.75rem;    /* 12 */
  --fs-sm: 0.875rem;   /* 14 */
  --fs-md: 1rem;       /* 16 */
  --fs-lg: 1.125rem;   /* 18 */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --fs-display: clamp(2.5rem, 1.6rem + 4.2vw, 4.5rem);

  /* Spacing (4px 기반) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-24: 6rem;

  /* Shape · Depth */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(34 40 36 / 0.06);
  --shadow-md: 0 1px 2px rgb(34 40 36 / 0.05), 0 6px 20px -4px rgb(34 40 36 / 0.08);
  --shadow-lg: 0 2px 4px rgb(34 40 36 / 0.04), 0 18px 48px -12px rgb(34 40 36 / 0.18);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;

  /* Layout */
  --container: 1200px;
  --gutter: 16px;
  --sidebar-w: 248px;
  --bottom-nav-h: 64px;

  color-scheme: light;
}

/* 다크 모드 — 같은 토큰 이름에 값만 바꿔서 화면 코드는 그대로 둔다 */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #121614;
    --c-surface: #1a1f1c;
    --c-surface-2: #232a26;
    --c-line: #2e3631;
    --c-line-strong: #414b45;
    --c-ink: #eef2ee;
    --c-ink-2: #c3cbc5;
    --c-ink-3: #9aa49d;
    --c-primary: #7cc49c;
    --c-primary-hover: #97d3b1;
    --c-primary-soft: #1d3329;
    --c-primary-text: #9ad6b4;
    --c-on-primary: #0f1a14;
    --c-success: #4ade80;
    --c-success-soft: #0f2e1c;
    --c-success-text: #86efac;
    --c-warning-soft: #3a2a10;
    --c-warning-text: #fbbf24;
    --c-danger: #f87171;
    --c-danger-hover: #fca5a5;
    --c-danger-soft: #3a1717;
    --c-muted-soft: #262d29;
    --c-muted-text: #d0d7d2;
    --c-rose-soft: #3b1820;
    --c-rose-text: #fda4af;
    --c-sky-soft: #132a3c;
    --c-sky-text: #93c5fd;
    --c-heat-0: #232a26;
    --c-heat-1: #2f4a3a;
    --c-heat-2: #4f8a68;
    --c-heat-3: #7cc49c;
    --c-focus: #60a5fa;
    --c-overlay: rgb(0 0 0 / 0.6);
    --shadow-md: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px -4px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 18px 48px -12px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

@media (min-width: 768px) {
  :root { --gutter: 32px; }
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a, button, [role="button"], label[for], summary { -webkit-tap-highlight-color: transparent; }
button, [role="button"], summary, select, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--c-primary-soft); color: var(--c-ink); }

img { height: auto; }

.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }

/* SVG 아이콘 스프라이트: 화면에는 그리지 않고 <use> 로만 참조 */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Utilities ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: fixed;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 1000;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--c-ink);
  color: var(--c-bg);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.text-amber { color: var(--c-warning-text); }
.text-green { color: var(--c-success-text); }
.text-muted { color: var(--c-ink-2); }

/* 형광펜 강조 — 제목 속 핵심 단어 */
.marker {
  background: linear-gradient(var(--c-primary-soft), var(--c-primary-soft)) no-repeat 0 88% / 100% 34%;
  padding-inline: 0.08em;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
