/* ═══════════════════════════════════════════════════
   Code Destiny Blog — blog-style.css
   다크/신비로운/보라-금 계열 블로그 공통 스타일
   ═══════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Noto+Serif+KR:wght@400;700&family=Cinzel:wght@400;700&display=swap');

/* ── CSS Variables ── */
:root {
  --color-bg: #020617;
  --color-bg-card: #0f172a;
  --color-bg-section: #0a0f24;
  --color-surface: #1e1b4b;
  --color-border: rgba(124, 58, 237, 0.25);
  --color-border-light: rgba(167, 139, 250, 0.15);
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-faint: #64748b;
  --color-accent: #a78bfa;
  --color-accent-bright: #c4b5fd;
  --color-gold: #fbbf24;
  --color-gold-light: #fde68a;
  --color-green: #34d399;
  --color-teal: #4ecdc4;
  --color-heading: #f4eeff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 24px rgba(139, 92, 246, 0.18);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.45);
  --font-sans: 'Noto Sans KR', system-ui, -apple-system, sans-serif;
  --font-serif: 'Noto Serif KR', Georgia, serif;
  --font-display: 'Cinzel', serif;
  --max-width: 800px;
  --line-height-body: 1.85;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(88, 28, 135, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(30, 27, 75, 0.15) 0%, transparent 50%);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent-bright); text-decoration: underline; }

/* ── Layout ── */
.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

article {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ── Disclaimer Banner ── */
.disclaimer-banner {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 27, 75, 0.98) 100%);
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  padding: 10px 20px;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(253, 230, 138, 0.85);
  letter-spacing: 0.015em;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.disclaimer-banner a { color: var(--color-gold); }

/* ── Navigation ── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  max-width: 960px;
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border-light);
  transition: all 0.2s;
}
.site-nav a:hover {
  color: var(--color-accent-bright);
  border-color: var(--color-accent);
  background: rgba(124, 58, 237, 0.1);
  text-decoration: none;
}
.site-nav .brand {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-accent-bright);
  border: none;
  background: none;
}
.site-nav .brand:hover { background: none; border: none; }

/* ── Article Header ── */
.article-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 40px;
}
.article-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gold);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 3px 10px;
  margin-bottom: 16px;
}
h1.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1.35;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.article-summary {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: 20px;
  max-width: 680px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--color-text-faint);
}
.article-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ── Headings ── */
h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.8vw, 1.6rem);
  color: var(--color-heading);
  font-weight: 700;
  margin: 48px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}
h2::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent), transparent);
}
h3 {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--color-accent-bright);
  font-weight: 700;
  margin: 28px 0 12px;
}
h4 {
  font-size: 1rem;
  color: var(--color-gold);
  font-weight: 700;
  margin: 20px 0 8px;
}

/* ── Paragraphs ── */
p {
  margin-bottom: 18px;
  font-size: 1rem;
  color: var(--color-text);
  word-break: keep-all;
  overflow-wrap: break-word;
}
section > p:first-of-type::first-letter {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--color-accent);
  float: left;
  line-height: 1;
  margin-right: 4px;
  margin-top: 4px;
}

/* ── Lists ── */
ul, ol {
  padding-left: 24px;
  margin-bottom: 18px;
}
li {
  margin-bottom: 8px;
  color: var(--color-text);
  line-height: 1.75;
}
ul li::marker { color: var(--color-accent); }
ol li::marker { color: var(--color-gold); font-weight: 700; }

/* ── Table of Contents ── */
.toc {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}
.toc::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-teal));
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 14px;
}
.toc ol {
  counter-reset: toc-counter;
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc li {
  counter-increment: toc-counter;
  margin-bottom: 6px;
}
.toc a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  transition: color 0.2s;
}
.toc a::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-size: 0.72rem;
  color: var(--color-accent);
  font-weight: 700;
  min-width: 22px;
}
.toc a:hover { color: var(--color-accent-bright); text-decoration: none; }

/* ── Callout Boxes ── */
.callout {
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 28px 0;
  position: relative;
  padding-left: 56px;
  line-height: 1.7;
  font-size: 0.95rem;
}
.callout::before {
  position: absolute;
  left: 18px;
  top: 18px;
  font-size: 1.4rem;
  line-height: 1;
}
.callout-tip {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-left: 3px solid var(--color-green);
  color: #a7f3d0;
}
.callout-tip::before { content: '💡'; }

.callout-warn {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-left: 3px solid var(--color-gold);
  color: #fde68a;
}
.callout-warn::before { content: '⚠️'; }

.callout-key {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-left: 3px solid var(--color-accent);
  color: var(--color-accent-bright);
}
.callout-key::before { content: '📌'; }

.callout strong { color: white; }

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead tr {
  background: linear-gradient(90deg, rgba(88, 28, 135, 0.5), rgba(30, 27, 75, 0.5));
}
th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--color-accent-bright);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
  color: var(--color-text);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124, 58, 237, 0.05); }

/* ── FAQ Accordion ── */
.faq-section { margin-top: 56px; }
.faq-section > h2 { margin-bottom: 24px; }

details.faq-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
details.faq-item[open] {
  border-color: var(--color-accent);
}
details.faq-item summary {
  padding: 18px 24px;
  cursor: pointer;
  font-weight: 700;
  color: var(--color-heading);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  list-style: none;
  font-size: 0.95rem;
  user-select: none;
  transition: background 0.2s;
}
details.faq-item summary:hover { background: rgba(124, 58, 237, 0.08); }
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--color-accent);
  font-weight: 300;
  flex-shrink: 0;
  transition: transform 0.2s;
}
details.faq-item[open] summary::after {
  content: '−';
}
.faq-answer {
  padding: 0 24px 20px;
  color: var(--color-text-muted);
  font-size: 0.93rem;
  line-height: 1.75;
  border-top: 1px solid var(--color-border-light);
  padding-top: 16px;
}

/* ── Related Articles ── */
.related-section { margin-top: 56px; }
.related-section > h2 { margin-bottom: 24px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.related-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: block;
  color: var(--color-text);
}
.related-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
  text-decoration: none;
  color: var(--color-text);
}
.related-card .tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  margin-bottom: 8px;
  display: block;
}
.related-card h4 {
  font-size: 0.9rem;
  color: var(--color-heading);
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.4;
}
.related-card p {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  margin: 0;
}

/* ── CTA Box ── */
.cta-box {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.4) 0%, rgba(30, 27, 75, 0.6) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin: 56px auto 0;
  max-width: var(--max-width);
  position: relative;
  overflow: hidden;
}
.cta-box::before {
  content: '';
  position: absolute;
  top: -40%; left: -20%;
  width: 60%; height: 180%;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.cta-box h3 {
  font-size: 1.4rem;
  color: var(--color-heading);
  font-family: var(--font-serif);
  margin-bottom: 12px;
}
.cta-box p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.cta-btn {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff !important;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
  text-decoration: none !important;
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.6);
}

/* ── SVG Diagram ── */
.diagram-wrapper {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 28px 0;
  overflow-x: auto;
  text-align: center;
}
.diagram-wrapper svg { max-width: 100%; height: auto; }

/* ── Highlight / Mark ── */
mark {
  background: rgba(251, 191, 36, 0.18);
  color: var(--color-gold-light);
  padding: 1px 4px;
  border-radius: 3px;
}
strong { color: var(--color-accent-bright); font-weight: 700; }
code {
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  background: rgba(124, 58, 237, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c4b5fd;
}

/* ── Definition Card ── */
.def-card {
  background: var(--color-bg-section);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 20px 0;
}
.def-card dt {
  font-weight: 700;
  color: var(--color-gold);
  font-size: 1rem;
  margin-bottom: 6px;
}
.def-card dd {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  padding-left: 0;
  margin: 0;
}

/* ── Character Card Grid ── */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.char-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.char-card .pillar-name {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--color-accent);
  margin-bottom: 4px;
}
.char-card .pillar-hanja {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  margin-bottom: 12px;
}
.char-card p { font-size: 0.88rem; margin-bottom: 0; color: var(--color-text-muted); }

/* ── Divider ── */
.section-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin: 48px 0;
}

/* ── Footer ── */
.blog-footer {
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  padding: 40px 20px;
  text-align: center;
  margin-top: 80px;
}
.blog-footer p {
  font-size: 0.82rem;
  color: var(--color-text-faint);
  margin-bottom: 8px;
}
.blog-footer a { color: var(--color-accent); }

/* ── Blog Index Cards ── */
.blog-hero {
  padding: 60px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 40px;
}
.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  background: linear-gradient(135deg, var(--color-accent-bright), var(--color-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.blog-hero p {
  color: var(--color-text-muted);
  max-width: 500px;
  margin: 0 auto;
}
.category-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  justify-content: center;
}
.filter-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--color-accent);
  color: var(--color-accent-bright);
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
.article-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}
.card-top {
  background: linear-gradient(135deg, var(--color-surface), rgba(10, 15, 36, 0.8));
  padding: 28px 24px 20px;
  flex: 1;
}
.card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  display: inline-block;
  margin-bottom: 10px;
}
.article-card h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
}
.card-excerpt {
  font-size: 0.85rem;
  color: var(--color-text-faint);
  line-height: 1.65;
  margin: 0;
}
.card-bottom {
  padding: 14px 24px;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--color-text-faint);
}
.card-read-link {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-read-link:hover { color: var(--color-accent-bright); text-decoration: none; }

/* ── Progress Reading Bar ── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c3aed, #4ecdc4);
  transition: width 0.1s ease;
  z-index: 999;
  pointer-events: none;
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
  .page-wrapper { padding: 0 16px 60px; }
  .article-header { padding: 32px 0 24px; }
  .toc { padding: 18px 20px; }
  .callout { padding: 16px 16px 16px 48px; }
  .callout::before { left: 12px; top: 14px; }
  .cta-box { padding: 28px 20px; }
  .char-grid { grid-template-columns: 1fr; }
  .site-nav { padding: 12px 16px; }
  .related-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  h1.article-title { font-size: 1.45rem; }
  .articles-grid { grid-template-columns: 1fr; }
  .table-wrapper { font-size: 0.82rem; }
  th, td { padding: 8px 12px; }
}
