/* ==========================================================================
   이혼가이드 (Divorce Guide) — Premium Law Firm Design
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --dg-navy: #0f172a;
  --dg-navy-light: #1e293b;
  --dg-gold: #d4a853;
  --dg-gold-light: #e8c97a;
  --dg-gold-dark: #b8923e;
  --dg-blue: #2563eb;
  --dg-blue-light: #3b82f6;
  --dg-white: #ffffff;
  --dg-gray-50: #f8fafc;
  --dg-gray-100: #f1f5f9;
  --dg-gray-200: #e2e8f0;
  --dg-gray-300: #cbd5e1;
  --dg-gray-400: #94a3b8;
  --dg-gray-500: #64748b;
  --dg-gray-600: #475569;
  --dg-gray-700: #334155;
  --dg-gray-800: #1e293b;
  --dg-radius-sm: 8px;
  --dg-radius: 12px;
  --dg-radius-lg: 16px;
  --dg-radius-pill: 999px;
  --dg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --dg-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
  --dg-shadow-md: 0 4px 6px rgba(15, 23, 42, 0.07), 0 10px 24px rgba(15, 23, 42, 0.1);
  --dg-shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1), 0 20px 48px rgba(15, 23, 42, 0.12);
  --dg-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --dg-font: 'Noto Sans KR', sans-serif;
}

/* ---------- Base Reset (scoped) ---------- */
.dg-chapter,
.dg-hub {
  font-family: var(--dg-font);
  color: var(--dg-navy);
  line-height: 1.75;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dg-chapter *,
.dg-hub * {
  box-sizing: border-box;
}

/* ---------- Layout ---------- */
.dg-chapter,
.dg-hub {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */
.dg-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--dg-gray-500);
  margin-bottom: 28px;
  padding: 10px 16px;
  background: var(--dg-gray-50);
  border-radius: var(--dg-radius-sm);
}

.dg-breadcrumb a {
  color: var(--dg-gray-600);
  text-decoration: none;
  transition: color var(--dg-transition);
}

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

.dg-breadcrumb span {
  color: var(--dg-gray-400);
}

/* ==========================================================================
   Chapter Header
   ========================================================================== */
.dg-chapter-header {
  margin-bottom: 32px;
  padding: 28px 28px 30px;
  background: linear-gradient(135deg, var(--dg-navy) 0%, var(--dg-navy-light) 60%, #16233f 100%);
  border-radius: var(--dg-radius-lg);
  box-shadow: var(--dg-shadow-md);
  position: relative;
  overflow: hidden;
}

.dg-chapter-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(212, 168, 83, 0.16) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dg-chapter-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dg-white);
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: 0;
  position: relative;
}

.dg-chapter-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--dg-gold) 0%, var(--dg-gold-dark) 100%);
  color: var(--dg-white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--dg-radius-pill);
  margin-bottom: 14px;
  letter-spacing: 0.06em;
  position: relative;
}

/* ==========================================================================
   Chapter Intro (인트로 설명 영역)
   ========================================================================== */
.dg-intro {
  background: linear-gradient(135deg, var(--dg-gray-50) 0%, #fefdf8 100%);
  border-left: 4px solid var(--dg-gold);
  border-radius: 0 var(--dg-radius) var(--dg-radius) 0;
  padding: 24px 28px;
  margin-bottom: 36px;
  box-shadow: var(--dg-shadow-sm);
}

.dg-intro p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--dg-gray-700);
  margin: 0 0 12px;
}

.dg-intro p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Steps Flow (절차 흐름도)
   ========================================================================== */
.dg-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
  padding: 28px 20px;
  background: var(--dg-white);
  border-radius: var(--dg-radius);
  box-shadow: var(--dg-shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dg-step {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.dg-step-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 72px;
}

.dg-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dg-gold) 0%, var(--dg-gold-dark) 100%);
  color: var(--dg-white);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.35);
  margin-bottom: 8px;
}

.dg-step-label {
  font-size: 0.78rem;
  color: var(--dg-gray-600);
  font-weight: 500;
  line-height: 1.3;
  max-width: 90px;
  word-break: keep-all;
}

.dg-step-connector {
  width: 36px;
  height: 2px;
  background: linear-gradient(90deg, var(--dg-gold-light), var(--dg-gold));
  margin: 0 6px;
  margin-bottom: 26px;
  flex-shrink: 0;
  border-radius: 1px;
}

.dg-step.is-last .dg-step-connector {
  display: none;
}

/* ==========================================================================
   TOC (목차)
   ========================================================================== */
.dg-toc {
  border-left: 3px solid var(--dg-gold);
  background: var(--dg-gray-50);
  border-radius: 0 var(--dg-radius) var(--dg-radius) 0;
  padding: 20px 24px 20px 28px;
  margin-bottom: 40px;
}

.dg-toc-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dg-navy);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dg-toc ol {
  list-style: none;
  counter-reset: toc-counter;
  margin: 0;
  padding: 0;
}

.dg-toc li {
  counter-increment: toc-counter;
  margin-bottom: 8px;
}

.dg-toc li:last-child {
  margin-bottom: 0;
}

.dg-toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--dg-gray-700);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--dg-radius-sm);
  transition: all var(--dg-transition);
}

.dg-toc a::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--dg-gold);
  min-width: 22px;
}

.dg-toc a:hover,
.dg-toc a.is-active {
  background: var(--dg-white);
  color: var(--dg-navy);
  box-shadow: var(--dg-shadow-sm);
}

/* ==========================================================================
   Sections
   ========================================================================== */
.dg-section {
  margin-bottom: 40px;
}

.dg-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dg-navy);
  margin: 0 0 20px;
  padding-bottom: 12px;
  position: relative;
}

.dg-section h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: var(--dg-gold);
  border-radius: 2px;
}

/* ==========================================================================
   Section Description (섹션 본문 설명)
   ========================================================================== */
.dg-section-desc {
  background: var(--dg-gray-50);
  border-left: 3px solid var(--dg-blue);
  border-radius: 0 var(--dg-radius-sm) var(--dg-radius-sm) 0;
  padding: 20px 24px;
  margin-bottom: 20px;
  position: relative;
}

.dg-section-desc::before {
  content: '📋';
  position: absolute;
  top: 18px;
  left: -14px;
  font-size: 0.9rem;
  background: var(--dg-white);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--dg-shadow-sm);
}

.dg-section-desc p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--dg-gray-600);
  margin: 0 0 10px;
}

.dg-section-desc p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Accordion (Q&A)
   ========================================================================== */
.dg-accordion-item {
  background: var(--dg-white);
  border: 1px solid var(--dg-gray-200);
  border-radius: var(--dg-radius);
  margin-bottom: 12px;
  box-shadow: var(--dg-shadow-sm);
  transition: all var(--dg-transition);
  border-left: 3px solid transparent;
  overflow: hidden;
}

.dg-accordion-item:hover {
  border-left-color: var(--dg-gold);
  box-shadow: var(--dg-shadow);
}

.dg-accordion-item.is-open {
  border-left-color: var(--dg-gold);
  box-shadow: var(--dg-shadow-md);
}

.dg-accordion-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--dg-font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dg-navy);
  text-align: left;
  transition: background var(--dg-transition);
  line-height: 1.5;
}

.dg-accordion-btn:hover {
  background: var(--dg-gray-50);
}

.dg-accordion-item.is-open .dg-accordion-btn {
  background: var(--dg-gray-50);
}

.dg-q-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dg-gold) 0%, var(--dg-gold-dark) 100%);
  color: var(--dg-white);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dg-a-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dg-blue) 0%, var(--dg-blue-light) 100%);
  color: var(--dg-white);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dg-accordion-text {
  flex: 1;
}

.dg-accordion-icon {
  width: 20px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dg-accordion-icon::before,
.dg-accordion-icon::after {
  content: '';
  position: absolute;
  background: var(--dg-gray-400);
  border-radius: 1px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dg-accordion-icon::before {
  top: 50%;
  left: 3px;
  right: 3px;
  height: 2px;
  transform: translateY(-50%);
}

.dg-accordion-icon::after {
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 2px;
  transform: translateX(-50%);
}

.dg-accordion-item.is-open .dg-accordion-icon::after {
  transform: translateX(-50%) scaleY(0);
  opacity: 0;
}

.dg-accordion-item.is-open .dg-accordion-icon {
  transform: rotate(180deg);
}

/* Panel slide animation */
.dg-accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dg-accordion-panel-inner {
  padding: 0 20px 20px 60px;
}

.dg-a-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.dg-a-body p {
  font-size: 0.93rem;
  line-height: 1.85;
  color: var(--dg-gray-700);
  margin: 0 0 12px;
}

.dg-a-body p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   CTA (상담 신청)
   ========================================================================== */
.dg-cta {
  background: linear-gradient(135deg, var(--dg-navy) 0%, var(--dg-navy-light) 50%, #162544 100%);
  color: var(--dg-white);
  text-align: center;
  padding: 40px 32px;
  border-radius: var(--dg-radius-lg);
  margin: 48px 0 40px;
  position: relative;
  overflow: hidden;
}

.dg-cta::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(212, 168, 83, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dg-cta-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 8px;
  position: relative;
}

.dg-cta-subtitle {
  font-size: 0.92rem;
  color: var(--dg-gray-300);
  margin: 0 0 24px;
  position: relative;
}

.dg-cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
}

.dg-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--dg-radius-pill);
  font-family: var(--dg-font);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--dg-transition);
}

.dg-cta-phone {
  background: var(--dg-white);
  color: var(--dg-navy);
}

.dg-cta-phone:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.dg-cta-consult {
  background: linear-gradient(135deg, var(--dg-gold) 0%, var(--dg-gold-dark) 100%);
  color: var(--dg-white);
}

.dg-cta-consult:hover {
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.4);
  transform: translateY(-2px);
}

/* ==========================================================================
   Sticky Mobile CTA Bar
   ========================================================================== */
.dg-sticky-cta {
  display: none;
}

@media (max-width: 640px) {
  .dg-sticky-cta {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.12);
  }

  .dg-sticky-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px;
    font-family: var(--dg-font);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
  }

  .dg-sticky-phone {
    background: var(--dg-navy);
    color: var(--dg-white);
  }

  .dg-sticky-kakao {
    background: #FEE500;
    color: #191919;
  }
}

/* ==========================================================================
   Chapter Navigation (이전/다음)
   ========================================================================== */
.dg-chapter-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
}

.dg-chapter-nav a {
  flex: 1;
  display: block;
  padding: 20px 24px;
  background: var(--dg-white);
  border: 1px solid var(--dg-gray-200);
  border-radius: var(--dg-radius);
  text-decoration: none;
  transition: all var(--dg-transition);
  box-shadow: var(--dg-shadow-sm);
}

.dg-chapter-nav a:hover {
  border-color: var(--dg-gold);
  box-shadow: var(--dg-shadow-md);
  transform: translateY(-2px);
}

.dg-chapter-nav a:first-child {
  text-align: left;
}

.dg-chapter-nav a:last-child {
  text-align: right;
}

.dg-nav-label {
  display: block;
  font-size: 0.78rem;
  color: var(--dg-gray-400);
  font-weight: 500;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dg-nav-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dg-navy);
}

/* ==========================================================================
   Hub Page (허브/목차)
   ========================================================================== */
.dg-hub-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 44px 28px;
  background: linear-gradient(135deg, var(--dg-navy) 0%, var(--dg-navy-light) 60%, #16233f 100%);
  border-radius: var(--dg-radius-lg);
  box-shadow: var(--dg-shadow-md);
  position: relative;
  overflow: hidden;
}

.dg-hub-header::before {
  content: '';
  position: absolute;
  top: -35%;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(212, 168, 83, 0.16) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dg-hub-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dg-white);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  position: relative;
}

.dg-hub-subtitle {
  font-size: 1rem;
  color: var(--dg-gray-300);
  margin: 0;
  position: relative;
}

.dg-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.dg-hub-card {
  background: var(--dg-white);
  border: 1px solid var(--dg-gray-200);
  border-top: 3px solid var(--dg-gold);
  border-radius: var(--dg-radius);
  padding: 28px 24px 24px;
  text-decoration: none;
  display: block;
  transition: all var(--dg-transition);
  box-shadow: var(--dg-shadow-sm);
  position: relative;
}

.dg-hub-card:hover {
  box-shadow: var(--dg-shadow-lg);
  transform: translateY(-3px);
  border-top-color: var(--dg-gold-dark);
}

.dg-hub-card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 10px;
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.15) 0%, rgba(212, 168, 83, 0.08) 100%);
  color: var(--dg-gold-dark);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--dg-radius-pill);
  margin-bottom: 14px;
}

.dg-hub-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dg-navy);
  margin: 0 0 8px;
  line-height: 1.4;
}

.dg-hub-card-desc {
  font-size: 0.88rem;
  color: var(--dg-gray-500);
  line-height: 1.6;
  margin: 0 0 16px;
}

.dg-hub-card-steps {
  font-size: 0.8rem;
  color: var(--dg-gray-400);
  margin: 0 0 12px;
}

.dg-hub-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dg-gold);
  text-decoration: none;
  transition: gap var(--dg-transition), color var(--dg-transition);
}

.dg-hub-card:hover .dg-hub-card-link {
  color: var(--dg-gold-dark);
  gap: 8px;
}

/* ==========================================================================
   Scroll Animations
   ========================================================================== */
.dg-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.dg-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.dg-animate:nth-child(2) { transition-delay: 0.1s; }
.dg-animate:nth-child(3) { transition-delay: 0.2s; }
.dg-animate:nth-child(4) { transition-delay: 0.3s; }
.dg-animate:nth-child(5) { transition-delay: 0.4s; }
.dg-animate:nth-child(6) { transition-delay: 0.5s; }

/* ==========================================================================
   Responsive — Tablet
   ========================================================================== */
@media (max-width: 768px) {
  .dg-chapter,
  .dg-hub {
    padding: 28px 16px 48px;
  }

  .dg-chapter-header h1 {
    font-size: 1.65rem;
  }

  .dg-hub-header h1 {
    font-size: 1.8rem;
  }

  .dg-intro {
    padding: 20px 22px;
  }

  .dg-section h2 {
    font-size: 1.25rem;
  }

  .dg-accordion-btn {
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .dg-accordion-panel-inner {
    padding: 0 16px 16px 48px;
  }

  .dg-cta {
    padding: 32px 24px;
  }

  .dg-cta-title {
    font-size: 1.2rem;
  }

  .dg-chapter-nav a {
    padding: 16px 18px;
  }

  .dg-steps {
    justify-content: flex-start;
    padding: 20px 16px;
  }
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */
@media (max-width: 480px) {
  .dg-chapter,
  .dg-hub {
    padding: 20px 14px 40px;
  }

  .dg-chapter-header h1 {
    font-size: 1.4rem;
  }

  .dg-hub-header h1 {
    font-size: 1.5rem;
  }

  .dg-hub-grid {
    grid-template-columns: 1fr;
  }

  /* Steps: horizontal scroll */
  .dg-steps {
    justify-content: flex-start;
    padding: 16px 12px;
    gap: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .dg-steps::-webkit-scrollbar {
    display: none;
  }

  .dg-step-number {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }

  .dg-step-label {
    font-size: 0.72rem;
    max-width: 70px;
  }

  .dg-step-connector {
    width: 24px;
    margin: 0 4px;
  }

  /* Stack navigation */
  .dg-chapter-nav {
    flex-direction: column;
    gap: 12px;
  }

  .dg-chapter-nav a:last-child {
    text-align: left;
  }

  .dg-cta {
    padding: 28px 18px;
    border-radius: var(--dg-radius);
  }

  .dg-cta-actions {
    flex-direction: column;
    gap: 10px;
  }

  .dg-cta-btn {
    width: 100%;
    justify-content: center;
  }

  .dg-accordion-panel-inner {
    padding: 0 14px 14px 14px;
  }

  .dg-section-desc {
    padding: 16px 18px 16px 20px;
  }

  .dg-section-desc::before {
    display: none;
  }

  .dg-toc {
    padding: 16px 18px 16px 22px;
  }

  .dg-breadcrumb {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
}

/* Reserve space at the bottom of chapter pages so the sticky CTA bar never
   overlaps the last section — must win over the padding shorthands above,
   which are declared later in the tablet/mobile blocks. */
@media (max-width: 640px) {
  .dg-chapter {
    padding-bottom: 88px !important;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .dg-cta,
  .dg-chapter-nav,
  .dg-breadcrumb,
  .dg-sticky-cta {
    display: none;
  }

  .dg-accordion-panel {
    max-height: none !important;
    overflow: visible;
  }

  .dg-animate {
    opacity: 1 !important;
    transform: none !important;
  }
}
