/* ============================================================
   goldiverse.com — Post Article Styles
   
   Design Direction: "Calm Authority"
   CSS 변수는 main.css의 :root에서 선언됩니다.
   ============================================================ */


/* ─── 1. Article Base ─── */

.post-article {
  line-height: 1.82;
  color: var(--text);
  font-family: inherit;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.post-article p {
  margin-bottom: 1.15em;
  color: var(--text-secondary);
}

.post-article strong {
  color: var(--text);
  font-weight: 700;
}

.post-article a:not(.btn):not(.related-link):not(.toc a) {
  color: var(--accent-mid);
  text-decoration-color: var(--accent-border);
  text-underline-offset: 3px;
  transition: color var(--transition), text-decoration-color var(--transition);
}

.post-article a:not(.btn):not(.related-link):not(.toc a):hover {
  color: var(--accent-light);
  text-decoration-color: var(--accent-light);
}


/* ─── 2. 구분선 (hr) ─── */

.post-article hr {
  border: 0;
  height: 0;
  border-top: 1px solid var(--border);
  margin: 48px 0;
  position: relative;
}


/* ─── 3. 헤딩 계층 ─── */

.post-article h2 {
  margin-top: 56px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  border-bottom: 2px solid var(--accent-wash);
  position: relative;
}

/* H2 왼쪽 작은 골드 악센트 바 */
.post-article h2::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--highlight);
  border-radius: 1px;
}

.post-article h3 {
  margin-top: 36px;
  margin-bottom: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.post-article h4 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}


/* ─── 4. 목차 (TOC) ─── */

.post-article .toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px 28px;
  margin: 32px 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* 목차 상단 골드 라인 */
.post-article .toc::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--highlight), var(--accent-mid));
}

.post-article .toc-title {
  margin: 0 0 16px;
  font-weight: 800;
  font-size: 1em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.post-article .toc-title::before {
  content: "📌";
  font-size: 0.85em;
}

.post-article .toc ul {
  margin: 0;
  padding-left: 0;
  list-style-type: none;
}

.post-article .toc li {
  margin: 0;
}

.post-article .toc li a {
  display: block;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.93em;
  border-radius: 6px;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.post-article .toc li a:hover {
  color: var(--accent);
  background: var(--accent-wash);
  border-left-color: var(--accent-mid);
  padding-left: 18px;
}


/* ─── 5. CTA 버튼 ─── */

.post-article .btn-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 32px 0 40px;
}

.post-article .btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 50px;
  padding: 0 28px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--white) !important;
  font-weight: 700;
  font-size: 0.94em;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(27, 58, 92, 0.2);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.post-article .btn:hover {
  background: var(--accent-mid);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(27, 58, 92, 0.25);
}

.post-article .btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(27, 58, 92, 0.2);
}

.post-article .btn.secondary {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-secondary) !important;
  box-shadow: var(--shadow-xs);
}

.post-article .btn.secondary:hover {
  background: var(--bg);
  border-color: var(--accent-mid);
  color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.post-article .btn .arrow {
  margin-left: 8px;
  font-weight: 900;
  transition: transform var(--transition);
}

.post-article .btn:hover .arrow {
  transform: translateX(3px);
}


/* ─── 6. 강조 · 배지 · 뮤트 ─── */

.post-article .accent {
  color: var(--text);
  background: linear-gradient(to top, var(--highlight-wash) 35%, transparent 35%);
  font-weight: 700;
  padding: 0 2px;
}

.post-article .post-ui-badge {
  display: inline-block;
  background: var(--accent-wash);
  color: var(--accent);
  border-radius: 5px;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 0.83em;
  border: 1px solid var(--accent-border);
  vertical-align: middle;
  letter-spacing: -0.01em;
}

.post-article .muted {
  color: var(--muted);
  font-size: 0.93em;
}


/* ─── 7. 테이블 (데스크톱) ─── */

.post-article .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  margin: 32px 0;
  background: var(--white);
}

.post-article .table-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;
}

.post-article .table-wrap table.table-wide  { min-width: 720px; }
.post-article .table-wrap table.table-mid   { min-width: 600px; }
.post-article .table-wrap table.table-narrow { min-width: 480px; }

.post-article th,
.post-article td {
  border: 1px solid var(--border-light);
  padding: 14px 18px;
  text-align: left;
  font-size: 0.93em;
  line-height: 1.5;
}

.post-article thead th {
  background: var(--bg);
  font-weight: 700;
  border-top: none;
  color: var(--accent);
  font-size: 0.86em;
  text-transform: none;
  letter-spacing: 0.02em;
}

.post-article th:first-child, .post-article td:first-child { border-left: none; }
.post-article th:last-child,  .post-article td:last-child  { border-right: none; }
.post-article tbody tr:last-child td { border-bottom: none; }

.post-article .table-wrap tbody tr {
  transition: background var(--transition);
}

.post-article .table-wrap tbody tr:hover {
  background-color: var(--accent-wash);
}

/* 표 내부 합계 행 */
.post-article .table-wrap tr[style*="background"] {
  border-top: 2px solid var(--border) !important;
}


/* ─── 7-M. 테이블 (모바일: 가로 스크롤) ─── */

@media (max-width: 680px) {
  .post-article .table-wrap {
    margin: 24px 0;
    border-radius: var(--r-sm);
  }

  .post-article th,
  .post-article td {
    padding: 11px 14px;
    font-size: 0.87em;
  }
}


/* ─── 8. FAQ 드롭다운 ─── */

.post-article .faq-wrap {
  margin: 28px 0;
}

.post-article .faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all var(--transition);
  background: var(--white);
}

.post-article .faq-item summary {
  padding: 18px 22px;
  font-weight: 700;
  font-size: 0.95em;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
  transition: all var(--transition);
}

.post-article .faq-item summary::-webkit-details-marker { display: none; }

.post-article .faq-item summary::after {
  content: '';
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M2 6h8' stroke='%231B3A5C' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.post-article .faq-item[open] {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.post-article .faq-item[open] summary {
  background: var(--accent-wash);
  color: var(--accent);
  border-bottom: 1px solid var(--border-light);
}

.post-article .faq-item[open] summary::after {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 6h8' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  transform: rotate(0deg);
}

.post-article .faq-content {
  padding: 20px 22px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.94em;
}


/* ─── 9. 계산식 / 수식 박스 ─── */

.post-article .formula-box {
  border: 1px solid var(--border);
  border-left: 4px solid var(--highlight);
  background: var(--bg-warm);
  border-radius: var(--r-sm);
  padding: 20px 24px;
  margin: 32px 0;
  box-shadow: var(--shadow-xs);
}

.post-article .formula-box .formula-title {
  margin: 0 0 14px;
  font-weight: 800;
  font-size: 0.93em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.post-article .formula-box .formula-title::before {
  content: "🧮";
  font-size: 0.85em;
}


/* ─── 10. 요약 포인트 박스 ─── */

.post-article .summary-points {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 26px;
  margin: 28px 0;
}

.post-article .summary-points ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.post-article .summary-points li {
  padding: 7px 0 7px 24px;
  position: relative;
}

.post-article .summary-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--highlight);
}


/* ─── 11. 이미지 ─── */

.post-article img.aligncenter {
  display: block;
  margin: 28px auto;
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.post-article a > img.aligncenter {
  transition: box-shadow var(--transition-slow);
}

.post-article a:hover > img.aligncenter {
  box-shadow: var(--shadow-md);
}


/* ─── 12. 내부 링크 카드 ─── */

.post-article .related-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--white);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}

.post-article .related-link:hover {
  border-color: var(--highlight-border);
  background: var(--highlight-wash);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-article .related-link::before {
  content: "→";
  font-size: 1em;
  font-weight: 700;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  transition: all var(--transition);
}

.post-article .related-link:hover::before {
  background: var(--accent);
  color: var(--white);
}

.post-article .related-link .related-link-title {
  font-weight: 700;
  font-size: 0.92em;
  color: var(--accent);
  line-height: 1.4;
}

.post-article .related-link .related-link-desc {
  font-size: 0.84em;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}


/* ─── 13. 리스트 가독성 ─── */

.post-article ul,
.post-article ol {
  padding-left: 22px;
  margin-bottom: 1.1em;
}

.post-article li {
  margin-bottom: 7px;
  color: var(--text-secondary);
}

.post-article li:last-child {
  margin-bottom: 0;
}

.post-article li strong {
  color: var(--text);
}

/* 중첩 리스트 간격 */
.post-article li > ul,
.post-article li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}


/* ─── 14. 접근성 포커스 ─── */

.post-article .btn:focus-visible,
.post-article .toc a:focus-visible,
.post-article .faq-item summary:focus-visible,
.post-article .related-link:focus-visible {
  outline: 3px solid rgba(27, 58, 92, 0.25);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}


/* ─── 15. 선택 텍스트 색상 ─── */

.post-article ::selection {
  background: var(--accent-wash);
  color: var(--accent);
}


/* ─── 16. 모바일 반응형 ─── */

@media (max-width: 680px) {
  .post-article {
    line-height: 1.76;
  }

  .post-article h2 {
    margin-top: 40px;
    margin-bottom: 16px;
    font-size: 1.22em;
    padding-bottom: 10px;
  }

  .post-article h2::before {
    width: 28px;
  }

  .post-article h3 {
    margin-top: 28px;
    font-size: 1.08em;
  }

  .post-article hr {
    margin: 36px 0;
  }

  .post-article .toc {
    padding: 18px 20px;
  }

  .post-article .toc li a {
    padding: 7px 12px;
    font-size: 0.89em;
  }

  .post-article .btn-wrap {
    flex-direction: column;
    align-items: stretch;
    margin: 24px 0 32px;
  }

  .post-article .btn {
    width: 100%;
    justify-content: center !important;
    height: 48px;
    font-size: 0.92em;
  }

  .post-article .faq-item summary {
    padding: 15px 16px;
    font-size: 0.9em;
  }

  .post-article .faq-content {
    padding: 16px;
    font-size: 0.9em;
  }

  .post-article .formula-box {
    padding: 16px 18px;
  }

  .post-article .related-link {
    padding: 14px 16px;
    gap: 12px;
  }

  .post-article .related-link .related-link-title {
    font-size: 0.88em;
  }

  .post-article .related-link .related-link-desc {
    font-size: 0.82em;
  }

  .post-article img.aligncenter {
    border-radius: var(--r-sm);
    margin: 20px auto;
  }

  .post-article .summary-points {
    padding: 18px 20px;
  }
}

/* 더 작은 화면 */
@media (max-width: 400px) {
  .post-article .toc li a {
    font-size: 0.86em;
    padding: 6px 10px;
  }

  .post-article th,
  .post-article td {
    padding: 10px 12px;
    font-size: 0.86em;
  }

  .post-article .btn {
    height: 46px;
    padding: 0 20px;
  }
}


/* ─── 17. 스크롤바 (테이블 가로스크롤 시, 데스크톱) ─── */

@media (min-width: 681px) {
  .post-article .table-wrap::-webkit-scrollbar {
    height: 6px;
  }

  .post-article .table-wrap::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 3px;
  }

  .post-article .table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  .post-article .table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--muted-light);
  }
}


/* ─── 18. 인쇄 최적화 ─── */

@media print {
  .post-article .btn-wrap,
  .post-article .related-link {
    display: none;
  }

  .post-article .faq-item {
    border: 1px solid #ccc;
  }

  .post-article .faq-item[open] summary {
    background: none;
  }

  .post-article .table-wrap {
    box-shadow: none;
  }
}
