/* =============================================================
   web-labs Lv2 — starter tokens + form styles (아래 'Form' 섹션 추가)
   ============================================================= */
/* =============================================================
   web-labs starter — design tokens + responsive + mobile nav
   순수 CSS. 빌드 도구 없음.
   ============================================================= */

/* ---- Design tokens ---- */
:root {
  /* color */
  --c-bg: #ffffff;
  --c-bg-soft: #f6f7fb;
  --c-surface: #ffffff;
  --c-border: #e6e8ef;
  --c-text: #1a1d29;
  --c-text-soft: #5b6072;
  --c-primary: #4f46e5;
  --c-primary-strong: #4338ca;
  --c-accent: #06b6d4;

  /* typography (fluid) */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  --fs-300: clamp(0.85rem, 0.82rem + 0.2vw, 0.95rem);
  --fs-400: clamp(1rem, 0.96rem + 0.25vw, 1.125rem);
  --fs-500: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --fs-600: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --fs-700: clamp(2rem, 1.6rem + 2vw, 3.25rem);

  /* spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* misc */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(26, 29, 41, 0.08);
  --shadow-sm: 0 4px 14px rgba(26, 29, 41, 0.06);
  --header-h: 68px;
  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* 안전망: 가로 오버플로 차단 */
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

/* ---- Layout helpers ---- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--space-24);
}

.section-title {
  font-size: var(--fs-600);
  text-align: center;
}

.section-lead {
  text-align: center;
  color: var(--c-text-soft);
  max-width: 48ch;
  margin: 0 auto var(--space-12);
}

/* ---- Accessibility ---- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  z-index: 1000;
  background: var(--c-text);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: var(--space-4);
}

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

/* =============================================================
   Header / Nav
   ============================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  /* 데스크톱에서만 backdrop-filter 사용. 모바일에서는 아래 미디어쿼리에서 제거.
     ⚠️ backdrop-filter는 position:fixed 자식의 컨테이닝 블록을 만들어
     모바일 풀스크린 패널을 헤더 높이 안에 가두는 버그를 유발하므로
     모바일에서는 반드시 제거한다. */
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: var(--fs-500);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark {
  color: var(--c-primary);
}
.brand-accent {
  color: var(--c-accent);
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
}
.nav-list a {
  text-decoration: none;
  color: var(--c-text-soft);
  font-weight: 600;
  font-size: var(--fs-300);
  transition: color 0.15s var(--ease);
}
.nav-list a:hover,
.nav-list a[aria-current] {
  color: var(--c-text);
}
.nav-cta {
  background: var(--c-primary);
  color: #fff !important;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
}
.nav-cta:hover {
  background: var(--c-primary-strong);
}

/* hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  margin-inline: auto;
  background: var(--c-text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =============================================================
   Hero
   ============================================================= */
.hero {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(79, 70, 229, 0.12), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(6, 182, 212, 0.1), transparent 55%),
    var(--c-bg-soft);
  padding-block: clamp(var(--space-16), 10vw, var(--space-24));
}
.hero-compact {
  padding-block: var(--space-16);
}
.hero-inner {
  max-width: 44ch;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--fs-300);
  font-weight: 700;
  color: var(--c-primary);
  margin: 0 0 var(--space-3);
}
.hero-title {
  font-size: var(--fs-700);
  margin-bottom: var(--space-4);
}
.hero-lead {
  font-size: var(--fs-400);
  color: var(--c-text-soft);
  margin-bottom: var(--space-8);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--fs-300);
  text-decoration: none;
  padding: var(--space-3) var(--space-6);
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--c-primary-strong);
}
.btn-ghost {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}
.btn-ghost:hover {
  border-color: var(--c-text-soft);
}

/* =============================================================
   Cards
   ============================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space-6);
}
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.card-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
}
.card h3 {
  font-size: var(--fs-500);
}
.card p {
  margin: 0;
  color: var(--c-text-soft);
  font-size: var(--fs-300);
}

/* ---- CTA band ---- */
.cta-band {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  text-align: center;
}
.cta-inner h2 {
  font-size: var(--fs-600);
}
.cta-inner p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-8);
}
.cta-band code {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.cta-band .btn-primary {
  background: #fff;
  color: var(--c-primary-strong);
}

/* ---- Prose ---- */
.prose {
  max-width: 65ch;
}
.prose h2 {
  font-size: var(--fs-500);
  margin-top: var(--space-12);
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li {
  margin-bottom: var(--space-2);
}
.roadmap li::marker {
  color: var(--c-primary);
  font-weight: 700;
}

/* =============================================================
   Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  padding-block: var(--space-12);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
}
.footer-brand {
  font-weight: 800;
  margin: 0;
}
.footer-note {
  margin: 0;
  color: var(--c-text-soft);
  font-size: var(--fs-300);
}

/* =============================================================
   Scroll reveal
   ============================================================= */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* =============================================================
   Mobile (<= 720px) — hamburger nav
   ⚠️ 핵심 버그 회피:
   1) 헤더 backdrop-filter 제거 → fixed 패널이 헤더에 갇히지 않음
   2) 패널 배경은 첫 프레임부터 불투명(#fff)
   3) 안쪽 항목만 페이드(opacity 0 → 1)
   ============================================================= */
@media (max-width: 720px) {
  .site-header {
    /* fixed 자식의 컨테이닝 블록 생성을 막기 위해 backdrop-filter 제거 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #ffffff;
  }

  .nav-toggle {
    display: flex;
  }

  /* 풀스크린 슬라이드 패널 */
  .nav-panel {
    position: fixed;
    inset: var(--header-h) 0 0 0; /* 헤더 아래부터 화면 끝까지 */
    background: #ffffff; /* 첫 프레임부터 불투명 — 헤더 내용 비침 방지 */
    border-top: 1px solid var(--c-border);
    padding: var(--space-8) var(--space-6) var(--space-12);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0s linear 0.3s;
    overflow-y: auto;
  }
  body.nav-open .nav-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s var(--ease), visibility 0s;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  .nav-list li {
    /* 안쪽 항목만 페이드 인 */
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }
  body.nav-open .nav-list li {
    opacity: 1;
    transform: none;
  }
  /* 순차 등장 */
  body.nav-open .nav-list li:nth-child(1) { transition-delay: 0.06s; }
  body.nav-open .nav-list li:nth-child(2) { transition-delay: 0.12s; }
  body.nav-open .nav-list li:nth-child(3) { transition-delay: 0.18s; }
  body.nav-open .nav-list li:nth-child(4) { transition-delay: 0.24s; }

  .nav-list a {
    display: block;
    font-size: var(--fs-500);
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--c-border);
  }
  .nav-cta {
    text-align: center;
    margin-top: var(--space-4);
    border-bottom: none;
  }

  /* 메뉴 열렸을 때 본문 스크롤 잠금 */
  body.nav-open {
    overflow: hidden;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* =============================================================
   Form (Lv2)
   ============================================================= */
.form-wrap {
  max-width: 560px;
  margin-inline: auto;
}
.form {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: clamp(var(--space-6), 4vw, var(--space-12));
  box-shadow: var(--shadow-sm);
}
.field {
  margin-bottom: var(--space-6);
}
.field label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-300);
  margin-bottom: var(--space-2);
}
.field .req {
  color: var(--c-primary);
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field textarea {
  resize: vertical;
  min-height: 7rem;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.field input.is-invalid,
.field textarea.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.field-error {
  min-height: 1.2em;
  margin: var(--space-2) 0 0;
  font-size: var(--fs-300);
  color: #dc2626;
}

/* 허니팟 — 화면에서 숨김 (display:none 은 일부 봇이 회피하므로 위치로 숨김) */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-submit {
  width: 100%;
}
.form-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form-status {
  min-height: 1.4em;
  margin: var(--space-4) 0 0;
  text-align: center;
  font-size: var(--fs-300);
  font-weight: 600;
}
.form-status.is-loading {
  color: var(--c-text-soft);
}
.form-status.is-success {
  color: #16a34a;
}
.form-status.is-error {
  color: #dc2626;
}
