/* N-XI 튜토리얼 공통 스타일 — 홈페이지(youd-01/index.html)와 같은 토큰·컴포넌트 (light 고정) */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --card: #ffffff;
  --ink: #0b0c0e;
  --body: #46484d;
  --muted: #74767b;
  --line: #e3e3e5;
  --primary: #2d8cff;
  --secondary: #1456d6;
  --soft: #c7c9cd;
  --grad: linear-gradient(135deg, #2d8cff, #1456d6);
  --radius: 10px;
  --wrap: 1160px;
  --read: 760px;
  --header-h: 68px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 20px rgba(16, 24, 40, .08);
  --shadow-card-hover: 0 2px 6px rgba(16, 24, 40, .08), 0 14px 32px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "D2Coding", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 17px; line-height: 1.8; -webkit-font-smoothing: antialiased; word-break: keep-all;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
.wrap { width: min(var(--wrap), calc(100% - 40px)); margin: 0 auto; position: relative; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: #000; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }

/* ---------- header (홈페이지와 동일) ---------- */
header.site {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
header.site .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img.mark { height: 22px; width: auto; }
.brand .wordmark { font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.brand .eq { font-size: 13px; color: var(--muted); letter-spacing: .04em; margin-left: 3px; }
.brand img.nxi { height: 20px; width: auto; }
nav.main ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
nav.main a { text-decoration: none; font-size: 15px; font-weight: 500; color: var(--body); padding: 8px 12px; border-radius: 999px; }
nav.main a:hover { background: rgba(23, 25, 28, .05); color: var(--ink); }
nav.main a[aria-current] { color: var(--secondary); background: rgba(45, 140, 255, .10); font-weight: 700; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--line); color: var(--ink); width: 44px; height: 44px; border-radius: 12px; cursor: pointer; font-size: 20px; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-card); }
.btn-primary:hover { box-shadow: var(--shadow-card-hover); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: #fff; }
.btn-ghost:hover { background: rgba(23, 25, 28, .04); }

/* ---------- common type ---------- */
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--secondary); margin: 0 0 14px; }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -.02em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--body); font-size: clamp(17px, 1.8vw, 20px); max-width: 760px; margin: 18px 0 0; }

/* ---------- page hero (목차·각 편 공통) ---------- */
.t-hero { position: relative; overflow: hidden; padding: 56px 0 48px; border-bottom: 1px solid var(--line); background: var(--surface); }
.t-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(900px 420px at 85% 0%, rgba(45, 140, 255, .12), transparent 60%), radial-gradient(600px 360px at 0% 100%, rgba(20, 86, 214, .07), transparent 60%);
}
.t-hero .wrap { z-index: 1; }
.crumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin: 0 0 22px; padding: 0; list-style: none; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--secondary); }
.crumb li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.t-hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 800; max-width: 900px; }
.t-hero h1 .sub { display: block; margin-top: 12px; font-size: clamp(18px, 2.1vw, 24px); font-weight: 600; color: var(--body); letter-spacing: -.01em; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.meta b { color: var(--ink); font-weight: 700; }

/* 1~10편 진행 표시 */
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 26px 0 0; padding: 0; list-style: none; }
.steps a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--muted); background: #fff; border: 1px solid var(--line); transition: border-color .2s, color .2s; }
.steps a:hover { border-color: var(--primary); color: var(--secondary); }
.steps li.done a { color: var(--secondary); background: rgba(45, 140, 255, .08); border-color: rgba(45, 140, 255, .28); }
.steps li.now a { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px rgba(20, 86, 214, .28); }

/* ---------- article layout ---------- */
.t-layout { display: grid; grid-template-columns: minmax(0, var(--read)) 220px; gap: 64px; justify-content: center; padding: 48px 0 24px; }
.t-cover { margin: 0 0 40px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(16, 24, 40, .14); background: #fff; }
article.t-body .t-cover img { width: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; cursor: default; }

article.t-body > p, article.t-body li { color: var(--body); }
article.t-body p { margin: 0 0 16px; }
article.t-body b, article.t-body strong { color: var(--ink); }
article.t-body h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; margin: 64px 0 18px; padding-top: 4px; }
article.t-body h2 .no { display: block; font-size: 13px; font-weight: 700; letter-spacing: .16em; color: var(--secondary); margin-bottom: 8px; }
article.t-body h3 { font-size: 20px; font-weight: 700; margin: 36px 0 12px; }
article.t-body ul, article.t-body ol { padding-left: 22px; margin: 0 0 16px; }
article.t-body li { margin: 6px 0; }
article.t-body a { color: var(--secondary); text-underline-offset: 3px; }
article.t-body code { font-family: var(--mono); background: #f1f1f2; border-radius: 5px; padding: 1px 6px; font-size: .86em; color: var(--ink); font-variant-ligatures: none; }
article.t-body pre { margin: 16px 0 22px; padding: 16px 18px; background: #11151c; color: #d7e3f5; border-radius: var(--radius); font-size: 14px; line-height: 1.65; overflow-x: auto; }
article.t-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* 그림 */
article.t-body img { margin: 22px auto 10px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); background: #fff; cursor: zoom-in; }
article.t-body img.narrow { max-width: 340px; }
article.t-body img.visual { border-color: var(--line); box-shadow: none; }
article.t-body picture img { cursor: default; }
article.t-body .cap { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 30px; }

/* 안내 상자 */
article.t-body blockquote { position: relative; margin: 24px 0; padding: 20px 22px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); color: var(--body); font-size: 16px; }
article.t-body blockquote > b:first-child { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
article.t-body blockquote > b:first-child + br { display: none; }
article.t-body blockquote::before { display: table; margin-bottom: 10px; font-size: 11px; font-weight: 800; letter-spacing: .12em; padding: 3px 10px; border-radius: 999px; }
article.t-body blockquote.goals { background: linear-gradient(180deg, rgba(45, 140, 255, .10), rgba(45, 140, 255, .02)); border-color: rgba(45, 140, 255, .28); box-shadow: none; }
article.t-body blockquote.goals::before { content: "THIS EPISODE"; color: #fff; background: var(--grad); }
article.t-body blockquote.tip::before { content: "TIP"; color: var(--secondary); background: rgba(45, 140, 255, .12); }
article.t-body blockquote.warn { border-left: 4px solid var(--ink); }
article.t-body blockquote.warn::before { content: "주의"; color: #fff; background: var(--ink); letter-spacing: .06em; }
article.t-body blockquote.key { border-left: 4px solid var(--primary); }
article.t-body blockquote.key::before { content: "정리"; color: #fff; background: var(--secondary); letter-spacing: .06em; }
article.t-body blockquote.prompt { background: #11151c; border-color: #11151c; color: #d7e3f5; }
article.t-body blockquote.prompt b { color: #fff; }
article.t-body blockquote.prompt::before { content: "AI에게 보내는 요청"; color: #11151c; background: #d7e3f5; letter-spacing: .02em; }

/* 표 */
.tbl { margin: 18px 0 26px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-card); }
article.t-body table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.6; }
article.t-body th, article.t-body td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
article.t-body tr:last-child td { border-bottom: none; }
article.t-body th { background: #f6f6f7; color: var(--ink); font-weight: 700; font-size: 14px; white-space: nowrap; }
article.t-body td { color: var(--body); }
article.t-body td.up { color: var(--secondary); font-weight: 700; }

/* 다음 편 예고 */
article.t-body h2.next-up { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--secondary); margin: 72px 0 12px; }
article.t-body h2.next-up + p { padding: 22px 24px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); }

/* 편 이동 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 48px 0 0; }
.pager a { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; background: var(--card); box-shadow: var(--shadow-card); transition: box-shadow .2s, transform .2s; }
.pager a:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.pager img { width: 112px; flex: none; border-radius: 8px; margin: 0; border: 0; box-shadow: none; cursor: pointer; }
.pager .dir { display: block; font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--secondary); }
.pager .ttl { display: block; font-weight: 700; color: var(--ink); line-height: 1.45; margin-top: 2px; }
.pager .next { grid-column: 2; flex-direction: row-reverse; text-align: right; }
.links { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.links p { margin: 0 0 6px; color: var(--muted); }
.links a { color: var(--secondary); }

/* 오른쪽 목차 */
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; font-size: 14px; }
.toc p { font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--muted); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.45; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--secondary); border-left-color: var(--secondary); font-weight: 700; }
.toc .back { display: inline-flex; margin-top: 22px; color: var(--secondary); font-weight: 700; text-decoration: none; }

/* 마지막 안내 띠 */
.t-cta { margin: 72px 0 0; padding: 72px 0; text-align: center; background: radial-gradient(800px 360px at 50% 0%, rgba(45, 140, 255, .12), transparent 70%), var(--bg); border-top: 1px solid var(--line); }
.t-cta h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; }
.t-cta p { color: var(--body); margin: 14px auto 0; max-width: 620px; }
.t-cta .cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 28px; }

/* ---------- 목차 페이지 ---------- */
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero-grid .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.line-card { margin: 0; padding: 18px; border-radius: 22px; background: #fff; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(16, 24, 40, .12); }
.line-card img { width: 100%; }
.line-card figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-card); }
.stat .v { font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { margin-top: 6px; font-size: 14px; color: var(--muted); }
.stat.hl { background: linear-gradient(160deg, rgba(45, 140, 255, .14), rgba(20, 86, 214, .08)); border-color: rgba(45, 140, 255, .32); }
.part { padding: 72px 0 8px; }
.part-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.part-head h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 800; }
.part-head p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 16px; }
.eps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
.ep { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); transition: box-shadow .2s ease, transform .2s ease; }
.ep:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.ep .thumb { aspect-ratio: 40 / 21; overflow: hidden; background: #eef3fb; }
.ep .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.ep:hover .thumb img { transform: scale(1.03); }
.ep .body { padding: 20px 24px 24px; }
.ep .no { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--secondary); }
.ep h3 { font-size: 20px; margin: 6px 0 8px; }
.ep p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.ep .go { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 700; color: var(--secondary); }

/* ---------- footer (홈페이지와 동일) ---------- */
footer.site { border-top: 1px solid var(--line); padding: 44px 0 56px; color: var(--muted); font-size: 14px; background: #f1f1f2; line-height: 1.7; }
footer.site .wrap { display: grid; gap: 8px; }
footer.site strong { color: var(--ink); font-size: 16px; }
footer.site a { color: var(--muted); }

/* 그림 확대 */
.zoom { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 24px; background: rgba(11, 12, 14, .82); backdrop-filter: blur(6px); cursor: zoom-out; }
.zoom.open { display: grid; }
.zoom img { max-width: min(1400px, 100%); max-height: 100%; border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); background: #fff; }

/* reveal */
.js .rv { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .rv.in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .t-layout { grid-template-columns: minmax(0, var(--read)); }
  .toc { display: none; }
}
@media (max-width: 980px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  nav.main { position: absolute; top: var(--header-h); left: 0; right: 0; background: rgba(255, 255, 255, .98); border-bottom: 1px solid var(--line); display: none; padding: 12px 20px 20px; }
  nav.main.open { display: block; }
  nav.main ul { flex-direction: column; }
  header.site .btn { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .t-hero { padding: 36px 0 32px; }
  .t-layout { padding-top: 28px; }
  .t-cover { border-radius: 14px; margin-bottom: 28px; }
  .eps { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .pager img { width: 88px; }
  .steps a { width: 32px; height: 32px; }
  article.t-body h2 { margin-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv { opacity: 1; transform: none; transition: none; }
}

/* 페이지 전환 (같은 사이트 안에서 페이지를 옮길 때. 미지원 브라우저는 그냥 넘어감) */
header.site { view-transition-name: site-header; }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: .22s ease-in both vt-out; }
  ::view-transition-new(root) { animation: .36s cubic-bezier(.2, .7, .2, 1) both vt-in; }
  ::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
  @keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
}
