/* ================================================================
   HAGO Design System — Deep Trust v2.0
   에메랄드 그린 전용 · Tonal Layering · 40대+ 가독성 최적화
   ================================================================ */

/* ===== DESIGN TOKENS ===== */
:root {
  /* 브랜드 (에메랄드 그린) */
  --accent: #006C49;
  --accent-hover: #005236;
  --accent-medium: #10B981;
  --accent-light: #4EDEA3;
  --accent-surface: #F0FDF4;

  /* 서피스 (Tonal Layering) */
  --bg-base: #F7F9FB;
  --bg-container: #F2F4F6;
  --bg-elevated: #FFFFFF;
  --bg-border: #E2E8F0;

  /* 다크 서피스 */
  --bg-dark: #0F1117;
  --bg-dark-container: #1A1D27;
  --bg-dark-elevated: #232733;

  /* 텍스트 */
  --text-primary: #191C1E;
  --text-secondary: #3C4A42;
  --text-tertiary: #6C7A71;
  --text-on-dark: #F1F3F5;
  --text-on-dark-sub: #9ED2B5;
  --text-on-dark-dim: #86868b;

  /* 라운드 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* 그림자 (에메랄드 기반) */
  --shadow-sm: 0 10px 40px rgba(0,108,73,0.04);
  --shadow-md: 0 10px 30px rgba(25,28,30,0.06);
  --shadow-lg: 0 10px 40px rgba(25,28,30,0.08);
  --shadow-hover: 0 12px 40px rgba(0,108,73,0.10);
}

/* ===== 리셋 & 베이스 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Pretendard Variable', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.8;
  letter-spacing: -0.02em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  letter-spacing: -0.03em;
  word-break: keep-all;
  line-height: 1.35;
}

p {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  color: var(--text-tertiary);
  max-width: 680px;
}

/* 라벨 (섹션 소제목) */
.label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ===== 레이아웃 ===== */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 8rem 0;
}

.text-center {
  text-align: center;
}

.text-center p {
  margin-left: auto;
  margin-right: auto;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mt-4 { margin-top: 4rem; }
.ml-2 { margin-left: 0.5rem; }

/* ===== 네비게이션 (Glassmorphism) ===== */
nav:not(.breadcrumb) {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(247, 249, 251, 0.72);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  /* 보더라인 제거 → tonal shadow로 대체 */
  box-shadow: 0 1px 0 rgba(0,108,73,0.06);
}

nav:not(.breadcrumb) .nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav:not(.breadcrumb) .logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

nav:not(.breadcrumb) .nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

nav:not(.breadcrumb) .nav-links a {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

nav:not(.breadcrumb) .nav-links a:hover,
nav:not(.breadcrumb) .nav-links a.active {
  color: var(--accent);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}
.breadcrumb li {
  display: flex;
  align-items: center;
}
.breadcrumb li:not(:last-child)::after {
  content: '>';
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  opacity: 0.5;
}
.breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumb a:hover {
  color: var(--accent);
}

/* ===== 히어로 ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 56px;
  background: var(--bg-base);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.25;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.hero p {
  margin-left: auto;
  margin-right: auto;
}

/* ===== 다크 섹션 ===== */
.section-dark {
  background: var(--text-primary);
  color: var(--text-on-dark);
}

.section-dark p {
  color: var(--text-on-dark-dim);
}

.section-dark .label {
  color: var(--accent-light);
}

/* ===== 라이트 그레이 섹션 (Tonal Layer) ===== */
.section-gray {
  background: var(--bg-container);
}

/* ===== 이미지 플레이스홀더 ===== */
.image-placeholder {
  width: 100%;
  max-width: 800px;
  margin: 3rem auto;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-container) 0%, var(--bg-border) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem;
}

.section-dark .image-placeholder {
  background: linear-gradient(135deg, #2d2d2f 0%, #3a3a3c 100%);
  color: var(--text-tertiary);
}

/* ===== 통계 그리드 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 3rem;
}

.stat-item {
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.stat-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.stat-number {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.section-dark .stat-number {
  color: var(--text-on-dark);
}

.stat-label {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

/* ===== 피처 행 ===== */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  margin-top: 4rem;
}

.feature-row.reverse {
  direction: rtl;
}

.feature-row.reverse > * {
  direction: ltr;
}

.feature-visual {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-container) 0%, var(--bg-border) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  padding: 1.5rem;
  text-align: center;
  overflow: hidden;
}

.section-dark .feature-visual {
  background: linear-gradient(135deg, #2d2d2f 0%, #3a3a3c 100%);
}

/* ===== CTA 버튼 ===== */
.cta-button {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.875rem 2rem;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 980px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,108,73,0.25);
}

.cta-button:active {
  transform: translateY(0);
  transform: scale(0.98);
}

.cta-button:focus-visible {
  outline: 3px solid rgba(0,108,73,0.5);
  outline-offset: 2px;
}

.cta-button.outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.cta-button.outline:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== 푸터 ===== */
footer {
  background: var(--text-primary);
  padding: 3rem 0 2rem;
  text-align: center;
  border-top: none;
}

footer p {
  font-size: 0.8125rem;
  color: var(--text-on-dark-dim);
  max-width: none;
}

/* ===== 컨택트 페이지 ===== */
.contact-hero {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--bg-base);
  padding-top: 6rem;
}

.contact-hero .label {
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.contact-hero h1 {
  margin-bottom: 1.5rem;
}

.contact-hero p {
  font-size: 1.25rem;
  color: var(--text-tertiary);
  max-width: 600px;
}

/* 카테고리 카드 */
.contact-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 4rem;
}

.category-card {
  background: var(--bg-elevated);
  /* 보더 대신 배경색 레이어링 */
  border: none;
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
  display: block;
}

.category-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.category-card p {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* 폼 섹션 */
.form-section {
  padding: 6rem 0;
  background: var(--bg-container);
}

.form-wrapper {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-md);
}

.form-wrapper h2 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.form-wrapper .form-sub {
  text-align: center;
  color: var(--text-tertiary);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-group label .required {
  color: var(--accent);
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  /* "No-Line Rule": 보더 대신 배경색 처리 */
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.0625rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-container);
  transition: box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  background: var(--bg-elevated);
  box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 1px var(--accent);
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin: 2rem 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.form-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.submit-button {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.0625rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.submit-button:hover {
  background: var(--accent-hover);
}

.submit-button:active {
  transform: scale(0.98);
}

.submit-button:disabled {
  background: var(--bg-border);
  cursor: not-allowed;
}

/* 확인 오버레이 */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.confirm-overlay.active {
  display: flex;
}

.confirm-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.confirm-card .checkmark {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--accent-medium);
}

.confirm-card h3 {
  font-size: 1.375rem;
  margin-bottom: 0.75rem;
}

.confirm-card p {
  color: var(--text-tertiary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* 빠른 연락 */
.info-bar {
  padding: 4rem 0;
  text-align: center;
}

.info-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.info-item {
  display: none;
}

.info-box {
  background: var(--bg-container);
  /* 보더 제거 → tonal layering */
  border: none;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.6;
}

.info-box strong {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.info-box span {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
}

.info-box a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.info-box a:hover {
  text-decoration: underline;
}

/* ===== h2 기본 크기 ===== */
h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.3;
}

/* ===== 스크롤 마진 ===== */
section[id] {
  scroll-margin-top: 68px;
}

/* ===== FAQ 섹션 ===== */
.faq-section {
  padding: 6rem 0;
  background: var(--bg-container);
}

.faq-section h2 {
  margin-bottom: 1rem;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
  /* 보더 제거 → shadow */
  border: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.faq-item:hover {
  box-shadow: var(--shadow-md);
}

.faq-item[open] {
  box-shadow: var(--shadow-lg);
}

.faq-question {
  padding: 1.25rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.15s ease;
}

.faq-question:hover {
  background: var(--accent-surface);
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item[open] .faq-question::after {
  content: '−';
  color: var(--accent);
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
}

.faq-answer p {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  line-height: 1.7;
  max-width: none;
}

/* ===== 브레드크럼 ===== */
.breadcrumb {
  padding-top: 64px;
  background: transparent;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.breadcrumb li::before {
  content: '';
}

.breadcrumb li + li::before {
  content: '›';
  margin-right: 0.5rem;
  color: var(--bg-border);
}

.breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb li[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 이미지 지연 로딩 페이드 인 ===== */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.5s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"][complete] {
  opacity: 1;
}

/* 피처 비주얼 내 이미지 보정 */
.feature-visual img {
  opacity: 1 !important;
}

/* ===== 텔레그램 플로팅 버튼 (공통) ===== */
.tg-float-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.tg-float-tooltip {
  background: var(--text-primary);
  color: var(--text-on-dark);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.tg-float-wrap:hover .tg-float-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.tg-float-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #00aaee);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
}

.tg-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 136, 204, 0.55);
}

.tg-float-btn::before {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 136, 204, 0.3);
  animation: tgPulse 2s ease-out infinite;
}

@keyframes tgPulse {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

.tg-float-btn svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  position: relative;
  z-index: 1;
}

/* ===== 반응형: 태블릿 ===== */
@media (max-width: 768px) {
  section { padding: 5rem 0; }
  .stat-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .feature-row { grid-template-columns: 1fr; gap: 2rem; }
  .feature-row.reverse { direction: ltr; }
  nav:not(.breadcrumb) .nav-links { gap: 1.25rem; }
  .contact-categories { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .info-items { grid-template-columns: 1fr; }
  .form-wrapper { padding: 2rem 1.5rem; }
  .stat-grid[style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .tg-float-wrap { bottom: 90px; right: 16px; }
  .tg-float-btn { width: 52px; height: 52px; }
  .tg-float-btn::before { width: 52px; height: 52px; }
  .tg-float-btn svg { width: 24px; height: 24px; }
}

/* ===== 반응형: 모바일 375px ===== */
@media (max-width: 480px) {
  section { padding: 3.5rem 0; }
  .container { padding: 0 1rem; }
  .hero { min-height: 85vh; padding-top: 56px; }
  .hero h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  nav .nav-links { gap: 0.75rem; }
  nav .nav-links a { font-size: 0.75rem; }
  .cta-button { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }
  .feature-row { gap: 1.5rem; margin-top: 2rem; }
  .stat-grid { gap: 1rem; }
  .faq-question { padding: 1rem 1.25rem; font-size: 1rem; }
  .faq-answer { padding: 0 1.25rem 1rem; }
  .breadcrumb { padding-top: 56px; }
  .breadcrumb ol { font-size: 0.75rem; }
  .contact-hero { min-height: 40vh; }
  .form-wrapper { padding: 1.5rem 1rem; }
}

/* ===== 접근성: 모션 감소 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
