@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", sans-serif;
  --bg: #0a0a0f;
  --surface: rgba(255,255,255,0.03);
  --text: #f0f0f5;
  --text-dim: #a8a8b8;
  --text-faint: #6b6b7d;
  --accent: #ec4899;
  --accent-2: #8b5cf6;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
}

* { box-sizing: border-box }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none }
a:hover { text-decoration: underline }

/* === Nav === */
.nav {
  position: sticky; top: 0;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  z-index: 50;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap;
}
.nav-brand {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 24px; flex-wrap: wrap; font-size: 14px; font-weight: 500 }
.nav-links a { color: var(--text-dim); transition: color .15s }
.nav-links a:hover { color: var(--text); text-decoration: none }

/* === Page (article + legal) === */
.page {
  max-width: 720px; margin: 0 auto;
  padding: 64px 24px;
}
.page h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--text);
}
.page h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 56px 0 16px;
  color: var(--text);
}
.page h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}
.page p {
  margin: 0 0 20px;
  font-size: 17px;
  line-height: 1.75;
  color: #d8d8e0;
}
/* Drop cap: 첫 본문 단락 첫 글자 */
.page > article > p:first-of-type::first-letter,
.post > p:first-of-type::first-letter,
.page > p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 4em;
  font-weight: 600;
  line-height: 0.85;
  padding: 6px 12px 0 0;
  color: var(--accent);
}

/* Article meta line */
.page .meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 16px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

/* Pull quote (LLM 의무 1개) */
.page blockquote.pull-quote {
  font-family: var(--serif);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.35;
  color: var(--text);
  text-align: center;
  padding: 36px 12px;
  margin: 48px 0;
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  position: relative;
}
.page blockquote.pull-quote::before {
  content: "“";
  display: block;
  font-size: 64px;
  color: var(--accent);
  line-height: 0.4;
  margin-bottom: 8px;
  font-style: normal;
}

/* Standard blockquote */
.page blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 20px;
  margin: 28px 0;
  color: var(--text-dim);
  font-style: italic;
}

/* Stat-box / callout (LLM 의무 1개) */
.page aside.stat-box,
.page aside.callout {
  background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(139,92,246,0.10));
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 24px 28px;
  margin: 36px 0;
}
.page aside.stat-box h3,
.page aside.callout h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 12px;
  color: var(--accent);
}
.page aside.stat-box ul,
.page aside.callout ul {
  margin: 0;
}
.page aside.stat-box li,
.page aside.callout li {
  font-family: var(--sans);
  font-size: 15px;
}

/* Cite-box (직접 인용 박스 — Reddit / HN / 연구 / 인터뷰) */
.page aside.cite-box {
  background: rgba(139,92,246,0.07);
  border-left: 4px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  padding: 24px 28px 20px;
  margin: 36px 0;
  position: relative;
}
.page aside.cite-box::before {
  content: "";
  position: absolute;
  top: 14px; left: 14px;
  width: 28px; height: 28px;
  background: var(--accent-2);
  border-radius: 50%;
  opacity: 0.12;
}
.page aside.cite-box blockquote {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.55;
  color: var(--text);
  border: none;
  padding: 0;
  margin: 0 0 12px;
}
.page aside.cite-box cite {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.page aside.cite-box cite a { color: var(--accent-2) }

/* Checklist (semantic ol with custom markers — actionable steps) */
.page ol.checklist {
  list-style: none;
  padding: 0;
  margin: 36px 0;
  counter-reset: checkitem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.page ol.checklist li {
  position: relative;
  padding: 18px 24px 18px 64px;
  border-bottom: 1px solid var(--border);
  margin: 0;
  counter-increment: checkitem;
  font-size: 15px;
  line-height: 1.65;
  color: #d8d8e0;
}
.page ol.checklist li:last-child { border-bottom: none }
.page ol.checklist li::before {
  content: counter(checkitem);
  position: absolute;
  left: 16px; top: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: white;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.page ol.checklist li strong {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--text);
  font-size: 16px;
  display: inline-block;
  margin-right: 4px;
}

/* Calc-table (계산식 테이블 — line-item math) */
.page table.calc-table {
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  background: rgba(236,72,153,0.04);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  margin: 32px 0;
}
.page table.calc-table th {
  font-family: var(--serif);
  font-size: 13px;
  background: rgba(139,92,246,0.08);
}
.page table.calc-table td {
  border-bottom: 1px solid var(--border);
}
.page table.calc-table tr.total td,
.page table.calc-table tr:last-child td {
  border-top: 2px solid var(--accent);
  border-bottom: none;
  font-weight: 700;
  color: var(--accent);
  font-size: 16px;
  background: rgba(236,72,153,0.06);
  padding-top: 18px;
  padding-bottom: 18px;
}

/* Operator CTA — 운영자 사업 자연 노출 박스 (광고 X, 도움 옵션 톤) */
.page aside.operator-cta,
aside.operator-cta {
  background: linear-gradient(135deg, rgba(139,92,246,0.10), rgba(236,72,153,0.08));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px 32px;
  margin: 48px 0 24px;
  position: relative;
}
.page aside.operator-cta h3,
aside.operator-cta h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.page aside.operator-cta p,
aside.operator-cta p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 12px;
  color: var(--text-dim);
}
.page aside.operator-cta a,
aside.operator-cta a {
  display: inline-block;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: white;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.page aside.operator-cta a:hover,
aside.operator-cta a:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(139,92,246,0.3);
  text-decoration: none;
  color: white;
}
.page aside.operator-cta a::after,
aside.operator-cta a::after { content: ""; }
.page aside.operator-cta small,
aside.operator-cta small {
  display: block;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* AdSense slot */
.page aside.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  padding: 14px;
  margin: 32px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  border-radius: 8px;
}
.page .editorial-note,
.page aside.editorial-note {
  background: rgba(139,92,246,0.08);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 28px 0;
  color: #d8d8e0;
  font-size: 15px;
}
.page .editorial-note strong,
.page aside.editorial-note strong { color: var(--text); }

/* Lists */
.page ul, .page ol { padding-left: 24px; margin: 0 0 24px; color: #d8d8e0 }
.page li { margin-bottom: 8px; line-height: 1.75 }

/* Tables — Economist style */
.page table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 15px;
  font-family: var(--sans);
}
.page thead { border-bottom: 2px solid var(--accent) }
.page th {
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.page td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: #d8d8e0;
}
.page tr:hover td { background: var(--surface) }

/* Image figure */
.page figure.post-image,
.page figure {
  margin: 40px -12px;
}
.page figure img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  display: block;
}
.page figure figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--serif);
  font-style: italic;
  margin-top: 14px;
}
.page .credit-list {
  list-style: none;
  padding: 0;
  margin: 32px 0;
}
.page .credit-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.page .credit-item strong {
  display: block;
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
}
.page .credit-item div a {
  display: inline-block;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 13px;
}
.page .credit-item p {
  margin: 8px 0 0;
  font-size: 14px;
}

/* Body links */
.page p a, .page li a, .page td a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
.page p a:hover, .page li a:hover, .page td a:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}
.page p a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.8em;
  opacity: 0.6;
  margin-left: 1px;
}

/* Card grid (catalog page legacy) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 40px;
}
.card {
  display: block;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none }
.card h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text) }
.card p { font-size: 14px; color: var(--text-dim); margin: 0 }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 40px 24px;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--sans);
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap }
.footer-links a { color: var(--text-dim) }
.footer-links a:hover { color: var(--text); text-decoration: none }

/* Mobile */
@media (max-width: 700px) {
  .page { padding: 44px 20px }
  .page > article > p:first-of-type::first-letter,
  .post > p:first-of-type::first-letter,
  .page > p:first-of-type::first-letter {
    font-size: 3em;
    padding: 4px 8px 0 0;
  }
  .page figure { margin: 32px -8px }
  .page figure img { border-radius: 12px }
  .page blockquote.pull-quote { padding: 24px 8px; margin: 32px 0 }
}

/* ===================== Motion layer — Editorial Kinetic ===================== */
/* CSS scroll-driven 우선(JS 0), 전부 prefers-reduced-motion 존중. 미지원 브라우저는 정적 폴백. */

/* 필름 그레인 (요소 추가 없이 의사요소) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.nav, .page, .footer { position: relative; z-index: 2 }

/* 상단 독서 진행바 (body::after + scroll-timeline) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::after {
      content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 60;
      transform-origin: 0 50%; transform: scaleX(0);
      background: linear-gradient(90deg, var(--accent-2), var(--accent));
      animation: readpro linear both; animation-timeline: scroll(root);
    }
    @keyframes readpro { to { transform: scaleX(1) } }
  }
}

/* 스크롤 진입 리빌 — 본문/법적 페이지 블록 (view-timeline) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .post > *,
    .page > h1, .page > h2, .page > h3, .page > p, .page > ul, .page > ol,
    .page > figure, .page > aside, .page > table, .page > blockquote {
      animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 26%;
    }
    @keyframes reveal { from { opacity: 0; transform: translateY(20px) } to { opacity: 1; transform: none } }
  }
}

/* 본문 인라인 링크 — hover 시 밑줄이 그려짐 */
.post a:not(.card), .page p a, .page li a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .32s cubic-bezier(.4, 0, .2, 1); padding-bottom: 1px;
}
.post a:not(.card):hover, .page p a:hover, .page li a:hover { background-size: 100% 1px; text-decoration: none }

/* H2 앞 액센트 틱 */
.post h2::before, .page h2::before {
  content: ""; display: block; width: 34px; height: 3px; margin-bottom: 14px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
