/* ===================================
   색상 대비 개선 및 가독성 강화 CSS
   WCAG 2.1 AA 기준 (4.5:1) 이상 준수
   ================================= */

/* 전역 색상 변수 재정의 - 더 강한 대비 */
:root {
  /* 텍스트 색상 - 더 진하게 */
  --text-primary: #0f172a !important;        /* 거의 검은색 */
  --text-secondary: #334155 !important;       /* 진한 회색 */
  --text-tertiary: #475569 !important;        /* 중간 회색 */
  --text-muted: #64748b !important;           /* 연한 회색 */
  --text-inverse: #ffffff !important;         /* 흰색 */

  /* 배경 색상 - 밝게 유지 */
  --bg-primary: #ffffff !important;
  --bg-secondary: #f8fafc !important;
  --bg-tertiary: #f1f5f9 !important;

  /* 브랜드 색상 - 더 진하게 조정 */
  --color-passion-600: #dc2626 !important;    /* 더 진한 빨강 */
  --color-passion-700: #b91c1c !important;
  --color-trust-600: #2563eb !important;      /* 더 진한 파랑 */
  --color-trust-700: #1d4ed8 !important;
  --color-innovation-600: #0891b2 !important; /* 더 진한 청록 */
  --color-forest-600: #059669 !important;     /* 더 진한 초록 */
}

/* 모든 텍스트의 최소 색상 대비 보장 */
body {
  color: #0f172a !important;
  background: #ffffff !important;
}

/* 제목들 - 더 진한 색상 */
h1, h2, h3, h4, h5, h6 {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* 일반 텍스트 */
p, li, span, div {
  color: #334155 !important;
}

/* Hero 섹션 텍스트 개선 */
.hero h1 {
  color: #0f172a !important;
  text-shadow: none !important;
}

.hero p,
.hero .lead {
  color: #334155 !important;
  opacity: 1 !important;
}

.hero-eyebrow {
  color: #475569 !important;
  background: rgba(255, 255, 255, 0.9) !important;
  padding: 0.5rem 1.25rem !important;
  border-radius: 2rem !important;
  font-weight: 600 !important;
}

/* Section 제목 및 설명 */
.section-title {
  color: #0f172a !important;
}

.section-description {
  color: #334155 !important;
}

.section-eyebrow {
  color: #475569 !important;
  background: rgba(255, 255, 255, 0.9) !important;
  padding: 0.375rem 1rem !important;
  border-radius: 1.5rem !important;
  border: 1px solid #e2e8f0 !important;
}

/* 카드 내부 텍스트 */
.feature-card h3,
.case-card h3,
.use-case h3 {
  color: #0f172a !important;
}

.feature-card p,
.case-card p,
.use-case p,
.feature-card li,
.case-card li,
.use-case li {
  color: #334155 !important;
}

/* 버튼 대비 개선 */
.btn-primary {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4) !important;
}

.btn-secondary {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 2px solid #0f172a !important;
  font-weight: 600 !important;
}

.btn-secondary:hover {
  background: #0f172a !important;
  color: #ffffff !important;
}

/* 어두운 배경 위의 텍스트 - 밝은 배경(#8-#f) 제외 */
.bg-dark,
.dark-section,
[style*="background: #0"] h1,
[style*="background: #1"] h1,
[style*="background: #2"] h1,
[style*="background: #3"] h1,
[style*="background: #4"] h1,
[style*="background: #5"] h1,
[style*="background: #6"] h1,
[style*="background: #7"] h1,
[style*="background: #0"] h2,
[style*="background: #1"] h2,
[style*="background: #2"] h2,
[style*="background: #3"] h2,
[style*="background: #4"] h2,
[style*="background: #5"] h2,
[style*="background: #6"] h2,
[style*="background: #7"] h2,
[style*="background: #0"] h3,
[style*="background: #1"] h3,
[style*="background: #2"] h3,
[style*="background: #3"] h3,
[style*="background: #4"] h3,
[style*="background: #5"] h3,
[style*="background: #6"] h3,
[style*="background: #7"] h3,
[style*="background: #0"] p,
[style*="background: #1"] p,
[style*="background: #2"] p,
[style*="background: #3"] p,
[style*="background: #4"] p,
[style*="background: #5"] p,
[style*="background: #6"] p,
[style*="background: #7"] p {
  color: #ffffff !important;
}

/* Gradient 텍스트 - 더 진한 색상으로 */
.gradient-text,
[style*="background-clip: text"] {
  background: linear-gradient(135deg, #dc2626 0%, #2563eb 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* 링크 대비 개선 - 버튼/CTA 제외 */
/* body copy 링크만 타겟팅 */
main p a:not([style*="background:"]),
article p a:not([style*="background:"]),
.content a:not([style*="background:"]),
p a:not(.btn):not([class*="cta"]):not([style*="background:"]) {
  color: #2563eb !important;
  text-decoration: none !important;
}

main p a:not([style*="background:"]):hover,
article p a:not([style*="background:"]):hover,
.content a:not([style*="background:"]):hover,
p a:not(.btn):not([class*="cta"]):not([style*="background:"]):hover {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
}

/* 그라디언트 CTA 가독성 보정 */
a[style*="linear-gradient"],
button[style*="linear-gradient"],
.header-cta,
.cta-button,
.btn.primary,
.btn.accent,
.btn.cta,
.btn.btn-primary,
.cta-card,
.cta-card * {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

/* 특정 배경색 위의 텍스트 대비 보장 */
[style*="background: linear-gradient"] {
  position: relative;
}

[style*="background: linear-gradient"] h1,
[style*="background: linear-gradient"] h2,
[style*="background: linear-gradient"] h3,
[style*="background: linear-gradient"] p,
[style*="background: linear-gradient"] span {
  position: relative;
  z-index: 1;
}

/* 연한 배경색 사용 시 텍스트 진하게 */
[style*="background: var(--color-passion-50)"],
[style*="background: var(--color-trust-50)"],
[style*="background: var(--color-innovation-50)"],
[style*="background: var(--color-forest-50)"] {
  background: #f8fafc !important;
}

[style*="background: var(--color-passion-50)"] *,
[style*="background: var(--color-trust-50)"] *,
[style*="background: var(--color-innovation-50)"] *,
[style*="background: var(--color-forest-50)"] * {
  color: #0f172a !important;
}

/* 아이콘 주변 텍스트 */
.feature-icon + h3,
.feature-icon + * + h3 {
  color: #0f172a !important;
  margin-top: 1rem !important;
}

/* Footer 텍스트 - 모두 흰색으로 통일 */
footer,
.footer-section {
  background: #0f172a !important;
  color: #ffffff !important;
}

footer h1, footer h2, footer h3, footer h4, footer h5, footer h6,
.footer-section h1, .footer-section h2, .footer-section h3 {
  color: #ffffff !important;
}

footer p, footer li, footer span, footer div, footer a,
.footer-section p, .footer-section li, .footer-section span, .footer-section div, .footer-section a {
  color: #ffffff !important;
}

footer a:hover,
.footer-section a:hover {
  color: #60a5fa !important;
}

/* 특수한 경우: 보라색/어두운 배경 */
[style*="background: #2d3561"],
[style*="background: #3730a3"],
[style*="background: rgb(45, 53, 97)"] {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

[style*="background: #2d3561"] *,
[style*="background: #3730a3"] *,
[style*="background: rgb(45, 53, 97)"] * {
  color: #ffffff !important;
}

/* Snorkl 페이지 특수 처리 */
body[style*="background: rgb(45, 53, 97)"],
body[style*="background: #2d3561"] {
  background: #ffffff !important;
}

/* 카드 hover 시에도 대비 유지 */
.feature-card:hover,
.case-card:hover {
  background: #ffffff !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15) !important;
}

.feature-card:hover h3,
.feature-card:hover p,
.case-card:hover h3,
.case-card:hover p {
  color: #0f172a !important;
}

/* 가격 카드 */
.pricing-card {
  background: #ffffff !important;
  border: 2px solid #e2e8f0 !important;
}

.pricing-card h3,
.pricing-card .price {
  color: #0f172a !important;
}

.pricing-card p,
.pricing-card li {
  color: #334155 !important;
}

/* CTA 섹션 */
.cta-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
}

.cta-section h2,
.cta-section p {
  color: #ffffff !important;
}

/* 접근성: Focus 상태 강조 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #2563eb !important;
  outline-offset: 2px !important;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #000000 !important;
    --text-secondary: #1a1a1a !important;
    --bg-primary: #ffffff !important;
  }

  .btn-primary {
    background: #000000 !important;
    border: 2px solid #000000 !important;
  }

  .btn-secondary {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
  }
}

/* 다크모드 사용자 고려 */
@media (prefers-color-scheme: dark) {
  /* 다크모드에서는 기본 밝은 테마 유지하되 대비 강화 */
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }
}

/* 텍스트 선택 시 대비 */
::selection {
  background: #2563eb !important;
  color: #ffffff !important;
}

::-moz-selection {
  background: #2563eb !important;
  color: #ffffff !important;
}

/* 추가: Lead 텍스트 */
.lead {
  color: #334155 !important;
  font-size: 1.25rem !important;
  line-height: 1.8 !important;
}

/* 추가: Subtitle */
.subtitle {
  color: #475569 !important;
}

/* 투명도 제거 - 모든 opacity 0.9 이하는 1로 */
[style*="opacity: 0.9"],
[style*="opacity: 0.8"],
[style*="opacity: 0.7"] {
  opacity: 1 !important;
}
