/* ============================================================
   AX-On Platform — Common CSS
   S7FE1: 공통 스타일 분리
   ============================================================ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS VARIABLES ── */
:root {
  /* INK (텍스트 전용 — 배경 사용 자제) */
  --ink: #1a1a2e;
  --ink-muted: #5a5f7d;

  /* SURFACE (페이지 계층) */
  --surface-cream: #fdfbf7;
  --surface: #faf9f7;
  --surface-warm: #f5f0eb;
  --surface-deep: #ebe1d2;          /* 강조 섹션 (검정 대체) */
  --surface-card: #ffffff;
  --surface-ink-soft: #2d3349;      /* 부드러운 잉크블루 (필요 시 footer 대체) */

  /* BRAND (Amber 중심) */
  --amber: #e8920d;
  --amber-light: #f5b942;
  --amber-deep: #c47a0a;             /* 호버/강조 */
  --amber-soft: #fff8ed;             /* 옅은 앰버 배경 */
  --amber-glow: rgba(232, 146, 13, 0.10);
  --teal: #0d9488;
  --teal-light: #2dd4bf;
  --coral: #e85d4a;
  --violet: #7c5ce0;
  --sky: #3b82f6;

  /* BORDER */
  --border-soft: rgba(26, 26, 46, 0.06);
  --border-strong: rgba(26, 26, 46, 0.12);
  --border-amber: rgba(232, 146, 13, 0.30);

  /* RADIUS — P2.1 토큰화 (--radius 20→16, --radius-lg 28→24, --radius-pill 신설) */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* SHADOW (P0-5: 4→2 통합) */
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-cta: 0 2px 8px rgba(232,146,13,0.18);
  /* legacy aliases — 점진적 마이그레이션 */
  --shadow-soft: var(--shadow-card);
  --shadow-hover: var(--shadow-card);
  --shadow-amber: var(--shadow-cta);

  /* SPACING — 8pt 격자 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --sp-7: 48px; --sp-8: 72px; --sp-9: 96px;

  /* TYPOGRAPHY — P1.3 위계 4-tier (원복) */
  --fw-h1: 900;   /* Hero H1 */
  --fw-h2: 800;   /* Section H2 */
  --fw-h3: 700;   /* Card H3 */
  --fw-lead: 500; /* H2 직하 리드 카피 */
  --fw-body: 400; /* Body */

  /* TYPOGRAPHY SCALE — 헤딩/리드 원래대로, 본문(--fs-body)만 16→15 다운 */
  --fs-display: clamp(34px, 4.4vw, 46px); /* Hero/Page 최상위 H1 — 원복 */
  --fs-h1:      clamp(28px, 3.4vw, 38px); /* Page H1 — 원복 */
  --fs-h2:      clamp(22px, 2.6vw, 28px); /* Section H2 — 원복 */
  --fs-h3:      clamp(18px, 1.9vw, 21px); /* Subsection / Card title — 원복 */
  --fs-h4:      16px;                     /* Card sub heading — 원복 */
  --fs-lead:    clamp(16px, 1.5vw, 18px); /* Subtitle / lead — 원복 */
  --fs-body:    14px;                     /* Body — 16→14 (사용자 표준: 14-15px 본문) */
  --fs-small:   14px;                     /* Small / footer — 원복 */
  --fs-tiny:    13px;                     /* Eyebrow / tag — 원복 */
  --fs-mega:    clamp(36px, 5vw, 52px);   /* Stats numbers — 원복 */

  --lh-tight:  1.25;
  --lh-snug:   1.4;
  --lh-normal: 1.65;
  --lh-loose:  1.8;

  /* HOVER — P2.2 4-tier (요소별 차등 피드백) */
  --hover-cta-tf: scale(1.02);
  --hover-cta-shadow: 0 4px 16px rgba(232,146,13,0.28);
  --hover-card-tf: translateY(-2px);
  --hover-card-shadow: 0 6px 20px rgba(0,0,0,0.06);
  --hover-link-color: var(--ink);
  --hover-nav-bg: rgba(26,26,46,0.04);

  /* DARK FOOTER (Tomorrow Night Blue — 유지) */
  --dark-bg: #002451;
  --dark-bg-deep: #001126;
  --dark-bg-hover: #00346e;
  --dark-bg-active: #003f8e;
  --dark-text-muted: #a3b3d6;        /* P0-1: WCAG AA — 5.5:1 대비 (was #7285b7 = 4.3:1) */
  --dark-border: rgba(163, 179, 214, 0.20);

  /* HARPX / SALID — Semantic 색상 토큰 (brand 팔레트와 분리) */
  --harpx-h: #FF8C00;   /* H — Human (담당자 작성) */
  --harpx-a: #00B4D8;   /* A — AI (자동수집) */
  --harpx-r: #00D4AA;   /* R — Rank (순위) */
  --harpx-p: #A78BFA;   /* P — Planning (계획) */
  --harpx-x: #48CAE4;   /* X — eXecution (실행) */
}

/* ── SKIP LINK (접근성) ── */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--amber); color: #fff;
  padding: 12px 24px; border-radius: 0 0 12px 12px;
  font-weight: 700; font-size: 16px;
  z-index: 999; text-decoration: none;
  transition: top 0.3s ease;
}
.skip-link:focus { top: 0; }

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(250, 249, 247, 0.85);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid rgba(26, 26, 46, 0.06);
  transition: all 0.4s ease;
}
.nav.scrolled {
  background: rgba(250, 249, 247, 0.95);
  box-shadow: 0 2px 20px rgba(26, 26, 46, 0.08);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 72px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.logo-mark {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 100%; height: 100%; display: block; }
.logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800; font-size: 22px;
  letter-spacing: -0.5px;
}
.logo-text span { color: var(--amber); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  text-decoration: none; color: #1a1a2e;
  font-size: 17px; font-weight: 700;
  padding: 8px 16px; border-radius: 10px;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--hover-nav-bg); }
.nav-links a.active { color: var(--amber); font-weight: 700; }

.nav-auth-mobile { display: none; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-auth-btn {
  text-decoration: none;
  font-size: 14px; font-weight: 600;
  padding: 8px 18px; border-radius: 10px;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
.nav-login {
  color: var(--ink-muted);
}
.nav-login:hover { color: var(--ink); }
.nav-signup {
  background: var(--amber); color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(232, 146, 13, 0.25);
}
.nav-signup:hover {
  transform: translateY(-1px);
  background: var(--amber-deep);
  box-shadow: 0 6px 18px rgba(232, 146, 13, 0.35);
}

.mobile-toggle {
  display: none; background: none; border: none;
  width: 40px; height: 40px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.mobile-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: all 0.3s ease;
}

/* ── NAV AUTH STATE ── */
.nav-user-wrap {
  display: flex; align-items: center; gap: 8px;
}
.nav-user-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  text-decoration: none; padding: 8px 12px; border-radius: 10px;
  transition: all 0.25s ease;
}
.nav-user-name:hover { background: rgba(26,26,46,0.04); }
.nav-logout-btn {
  font-size: 13px; font-weight: 600; color: var(--ink-muted);
  background: none; border: 1.5px solid rgba(26,26,46,0.12);
  padding: 6px 14px; border-radius: 10px; cursor: pointer;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  transition: all 0.25s ease;
}
.nav-logout-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 16px 32px; border-radius: 14px;
  font-size: 16px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: all 0.3s ease; border: none;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
.btn-primary {
  background: linear-gradient(135deg, var(--amber), #d4820b);
  color: #fff;
  box-shadow: 0 6px 24px rgba(232, 146, 13, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(232, 146, 13, 0.4);
}
.btn-outline {
  background: transparent; color: var(--ink);
  border: 2px solid rgba(26, 26, 46, 0.15);
}
.btn-outline:hover {
  border-color: var(--ink); background: rgba(26, 26, 46, 0.03);
}

/* ── FOOTER ── */
.footer {
  padding: 24px 40px 16px;
  background: var(--dark-bg);
  color: var(--dark-text-muted);
}
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
}
.footer-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800; font-size: 20px; color: #fff;
  text-align: center;
}
.footer-logo span { color: var(--amber); }
.footer-org-name {
  font-size: 15px; color: rgba(255,255,255,0.85); font-weight: 600;
  margin-top: 4px; text-align: center; letter-spacing: 0.5px;
}
.footer-org-person {
  font-size: 13px; color: var(--dark-text-muted);
  margin-top: 2px; text-align: center;
}
.footer-links { display: flex; gap: 24px; order: -1; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--dark-border); width: 100%; justify-content: center; }
.footer-links a {
  color: #fff;
  text-decoration: none;
  font-size: 14px; font-weight: 700; transition: color 0.3s ease;
}
.footer-links a:hover { color: var(--amber); }
.footer-copyright {
  max-width: 1280px; margin: 6px auto 0; padding: 6px 40px 0;
  border-top: 1px solid var(--dark-border);
  text-align: center; font-size: 13px; color: var(--dark-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  opacity: 0; transform: translateY(24px);
  transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ── ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── RESPONSIVE — NAV & FOOTER ── */
@media (max-width: 768px) {
  /* NAV */
  .nav-inner { padding: 0 16px; }
  .nav-links { display: none; }
  .mobile-toggle { display: flex; min-width: 44px; min-height: 44px; }
  .nav-login { display: none; }
  .nav-signup { display: none; }
  .nav-user-wrap .nav-user-name { display: none; }
  .nav-user-wrap .nav-logout-btn { display: none; }

  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 72px; left: 0; right: 0;
    background: var(--surface);
    padding: 12px 16px 20px;
    border-bottom: 1px solid rgba(26,26,46,0.06);
    box-shadow: 0 8px 24px rgba(26,26,46,0.08);
    gap: 2px;
  }
  .nav-links.open a {
    padding: 12px 16px;
    min-height: 44px;
    display: flex; align-items: center;
    font-size: 16px;
    border-radius: 10px;
  }
  .nav-links.open .nav-auth-mobile {
    display: flex !important;
  }
  .nav-auth-mobile {
    display: none;
    text-decoration: none;
    font-size: 16px; font-weight: 600;
    padding: 12px 16px; border-radius: 10px;
    min-height: 44px; align-items: center;
    transition: all 0.25s ease;
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    white-space: nowrap;
  }
  .nav-auth-mobile.login-mobile {
    color: var(--ink-muted);
    margin-top: 8px;
    border-top: 1px solid rgba(26,26,46,0.06);
    padding-top: 16px;
  }
  .nav-auth-mobile.login-mobile:hover { color: var(--ink); background: rgba(26,26,46,0.04); }
  .nav-auth-mobile.signup-mobile {
    background: var(--amber); color: #fff;
    margin-top: 6px;
  }
  .nav-auth-mobile.signup-mobile:hover { background: var(--amber-deep); }

  /* FOOTER */
  .footer { padding: 24px 16px 16px; }
  .footer-inner { text-align: center; gap: 6px; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 12px; }
  .footer-links a { min-height: 44px; display: inline-flex; align-items: center; }
  .footer-copyright { padding: 6px 8px 0; font-size: 14px; }
}

@media (max-width: 480px) {
  .nav-inner { padding: 0 12px; }
  .footer-links { gap: 12px; }
  .footer-copyright { font-size: 14px; }
}

/* ── ACCESSIBILITY: prefers-reduced-motion 글로벌 fallback (S1AC3) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
