*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #E67E22;
  --brand-dark: #C4671B;
  --brand-light: #FEF3E2;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --bg: #FFFFFF;
  --bg-subtle: #F9FAFB;
  --bg-warm: #FFF9F2;
  --border: #E5E7EB;
  --radius: 16px;
  --card-radius: 20px;
  --card-shadow: 0 12px 32px rgba(15,23,42,0.06);
  --icon-stroke: 1.6;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ─── NAV ─── */
.legal-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229,231,235,0.7);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-logo-icon {
  width: 46px; height: 46px;
  background: var(--brand);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(230,126,34,0.3);
}
.nav-logo-icon img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.nav-logo-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 23px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.nav-logo-text img { width: auto; height: 23px; display: block; }
.nav-logo-text span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.nav-back:hover { background: #F3F4F6; color: var(--text-primary); }
.nav-back svg { transition: transform 0.2s; }
.nav-back:hover svg { transform: translateX(-3px); }

/* ─── PAGE ─── */
.legal-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 128px 24px 96px;
}
.legal-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.legal-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.legal-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}
.legal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* ─── LOADING ─── */
.legal-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}
.legal-loading p { margin-top: 16px; font-size: 14px; }
.legal-spinner {
  width: 36px; height: 36px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ERROR ─── */
.legal-error {
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
}
.legal-error p { font-size: 15px; }

/* ─── CONTENT ─── */
.legal-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
}
.legal-content > *:first-child { margin-top: 0; }
.legal-content > *:last-child { margin-bottom: 0; }

/* Headings */
.legal-content h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
  line-height: 1.3;
}
.legal-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 40px;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
  line-height: 1.35;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(229,231,235,0.6);
}
.legal-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.legal-content h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 24px;
  margin-bottom: 10px;
  line-height: 1.4;
}

/* Paragraphs */
.legal-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* Lists */
.legal-content ul,
.legal-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}
.legal-content ul { list-style: disc; }
.legal-content ol { list-style: decimal; }
.legal-content li {
  margin-bottom: 8px;
  line-height: 1.75;
}
.legal-content li > ul,
.legal-content li > ol {
  margin-top: 8px;
  margin-bottom: 0;
}
.legal-content .notion-nested-list {
  list-style: disc;
  padding-left: 24px;
  margin-top: 8px;
}

/* Inline formatting */
.legal-content strong { font-weight: 700; color: var(--text-primary); }
.legal-content em { font-style: italic; }
.legal-content del { text-decoration: line-through; }
.legal-content u { text-decoration: underline; }
.legal-content code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--brand-dark);
}
.legal-content a {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.legal-content a:hover { color: var(--brand); }

/* Block elements */
.legal-content blockquote.notion-quote {
  border-left: 3px solid var(--brand);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-warm);
  border-radius: 0 12px 12px 0;
  color: var(--text-primary);
  font-style: italic;
}
.legal-content hr.notion-divider {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* Callout */
.legal-content .notion-callout {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: var(--brand-light);
  border-radius: 12px;
  margin: 20px 0;
  color: var(--text-primary);
}
.legal-content .notion-callout-icon { font-size: 18px; flex-shrink: 0; }
.legal-content .notion-callout > div { flex: 1; }
.legal-content .notion-callout p { margin-bottom: 0; color: var(--text-primary); }

/* Code block */
.legal-content pre.notion-code {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.6;
}
.legal-content pre.notion-code code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Toggle */
.legal-content details.notion-toggle {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.legal-content details.notion-toggle summary {
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-subtle);
  list-style: none;
  transition: background 0.2s;
}
.legal-content details.notion-toggle summary:hover { background: #F3F4F6; }
.legal-content details.notion-toggle summary::after {
  content: '▸';
  float: right;
  transition: transform 0.2s;
}
.legal-content details.notion-toggle[open] summary::after { transform: rotate(90deg); }
.legal-content details.notion-toggle > *:not(summary) {
  padding: 0 20px;
}
.legal-content details.notion-toggle > *:last-child { padding-bottom: 16px; }

/* Table */
.legal-content .notion-table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.legal-content table.notion-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.legal-content table.notion-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-primary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.legal-content table.notion-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(229,231,235,0.5);
}
.legal-content table.notion-table tr:last-child td { border-bottom: none; }

/* Image */
.legal-content figure.notion-image {
  margin: 24px 0;
  text-align: center;
}
.legal-content figure.notion-image img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}
.legal-content figure.notion-image figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Embed */
.legal-content .notion-embed {
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.legal-content .notion-embed iframe {
  width: 100%;
  min-height: 400px;
  border: none;
}

/* Bookmark */
.legal-content a.notion-bookmark {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  text-decoration: none;
  word-break: break-all;
}

/* Columns */
.legal-content .notion-column-list {
  display: flex;
  gap: 20px;
  margin: 20px 0;
}
.legal-content .notion-column { flex: 1; min-width: 0; }

/* Unsupported block placeholder */
.legal-content .notion-unsupported {
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 12px 0;
}

/* ─── FOOTER ─── */
.legal-footer {
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  text-decoration: none;
}
.footer-logo-icon {
  width: 28px; height: 28px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.footer-logo-icon img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.footer-logo-text {
  display: flex; align-items: center; gap: 5px;
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
}
.footer-logo-text img { width: auto; height: 15px; display: block; }
.footer-logo-text span { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 16px;
}
.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-secondary); }

/* ─── BACK TO TOP ─── */
#backToTop {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, background 0.2s;
  z-index: 90;
  box-shadow: 0 6px 20px rgba(230,126,34,0.35);
}
#backToTop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#backToTop:hover { background: var(--brand-dark); transform: translateY(-2px); }

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .legal-nav { padding: 12px 16px; }
  .legal-wrap { padding: 100px 16px 60px; }
  .legal-content { font-size: 14.5px; }
  .legal-content h1 { font-size: 22px; }
  .legal-content h2 { font-size: 18px; }
  .legal-content h3 { font-size: 16px; }
  .legal-content .notion-column-list { flex-direction: column; }
  .nav-back { padding: 6px 12px; font-size: 12px; }
  .nav-logo-text { font-size: 20px; }
  .nav-logo-text img { height: 20px; }
  .nav-logo-text span { font-size: 14px; }
}
