/* TestForge — 검증 도구 가이드 공통 스타일 (scripts/build-tools.mjs가 생성하는 페이지 전용)
   기본은 화이트톤. 다크는 사용자가 토글로 고를 때만 :root[data-theme="dark"]로 적용한다(OS 설정은 따르지 않음). */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fb; --bg-card: #ffffff; --bg-soft: #f1f5f9; --bg-nav: rgba(255,255,255,0.92);
  --border: #e2e8f0; --border-hi: #cbd5e1;
  --text: #0f172a; --text-muted: #475569; --text-dim: #64748b;
  --accent: #2563eb; --accent-bg: #eff6ff; --accent-border: rgba(37,99,235,0.25);
  --code-bg: #0f172a; --code-text: #e2e8f0; --code-head: #1e293b; --code-dim: #94a3b8;
  --inline-code-bg: #eef2ff; --inline-code-text: #3730a3;
  --tip-bg: #ecfdf5; --tip-border: #a7f3d0;
  --warn-bg: #fffbeb; --warn-border: #fde68a;
  --info-bg: #eff6ff; --info-border: #bfdbfe;
  --danger-bg: #fef2f2; --danger-border: #fecaca;
  --hero-from: #eff6ff; --hero-to: #f5f3ff;
  --tool: var(--accent);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1120; --bg-card: #111827; --bg-soft: #1e293b; --bg-nav: rgba(11,17,32,0.9);
  --border: #1f2a3d; --border-hi: #334155;
  --text: #e5e7eb; --text-muted: #a7b1c2; --text-dim: #7c8799;
  --accent: #60a5fa; --accent-bg: rgba(96,165,250,0.12); --accent-border: rgba(96,165,250,0.35);
  --code-bg: #020617; --code-text: #e2e8f0; --code-head: #0f172a; --code-dim: #94a3b8;
  --inline-code-bg: rgba(129,140,248,0.16); --inline-code-text: #c7d2fe;
  --tip-bg: rgba(16,185,129,0.1); --tip-border: rgba(16,185,129,0.35);
  --warn-bg: rgba(245,158,11,0.1); --warn-border: rgba(245,158,11,0.35);
  --info-bg: rgba(59,130,246,0.1); --info-border: rgba(59,130,246,0.35);
  --danger-bg: rgba(239,68,68,0.1); --danger-border: rgba(239,68,68,0.35);
  --hero-from: #0f172a; --hero-to: #1e1b3a;
  color-scheme: dark;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', 'Pretendard', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; line-height: 1.7; overflow-x: hidden; }
a { color: inherit; }

/* ── HERO / HEADERS ──────────────────────────────── */
.tf-hero { background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%); border-bottom: 1px solid var(--border); }
.tf-hero-inner { max-width: 1320px; margin: 0 auto; padding: 2.5rem 1.5rem 2.25rem; }
.tf-crumbs { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.tf-crumbs a { color: var(--text-muted); text-decoration: none; }
.tf-crumbs a:hover { color: var(--accent); }
.tf-eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; color: #fff; background: var(--tool); padding: 0.22rem 0.75rem; border-radius: 999px; margin-bottom: 0.75rem; }
.tf-hero h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); font-weight: 850; letter-spacing: -0.035em; line-height: 1.2; margin-bottom: 0.6rem; }
.tf-hero .lead { font-size: 1rem; color: var(--text-muted); max-width: 760px; }
.tf-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; margin-top: 1rem; font-size: 0.8rem; color: var(--text-dim); }
.tf-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.tf-chip { font-size: 0.74rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); }

/* ── LESSON LAYOUT ───────────────────────────────── */
.tf-layout { max-width: 1320px; margin: 0 auto; padding: 2rem 1.5rem 4rem; display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 2.5rem; align-items: start; }
.tf-layout.no-toc { grid-template-columns: 250px minmax(0, 1fr); }
.tf-side { position: sticky; top: 112px; max-height: calc(100vh - 130px); overflow-y: auto; }
.tf-side h3 { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; color: var(--text-dim); margin: 0 0 0.6rem 0.5rem; }
.tf-track { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; counter-reset: lesson; }
.tf-track a { display: flex; gap: 0.55rem; align-items: baseline; padding: 0.42rem 0.55rem; border-radius: 8px; text-decoration: none; font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.tf-track a:hover { background: var(--bg-soft); color: var(--text); }
.tf-track a .n { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); min-width: 1.3rem; font-variant-numeric: tabular-nums; }
.tf-track a.active { background: var(--accent-bg); color: var(--text); font-weight: 600; }
.tf-track a.active .n { color: var(--tool); }
.tf-side .tf-back { display: block; margin: 0 0 1rem 0.5rem; font-size: 0.8rem; color: var(--text-dim); text-decoration: none; }
.tf-side .tf-back:hover { color: var(--accent); }
.tf-toc { position: sticky; top: 112px; font-size: 0.8rem; }
.tf-toc h3 { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.5rem; }
.tf-toc ol { list-style: none; border-left: 1px solid var(--border); }
.tf-toc a { display: block; padding: 0.25rem 0 0.25rem 0.8rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-dim); text-decoration: none; line-height: 1.4; }
.tf-toc a:hover { color: var(--text); }
.tf-toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* ── ARTICLE ─────────────────────────────────────── */
.tf-article { min-width: 0; font-size: 0.98rem; }
.tf-article > *:first-child { margin-top: 0; }
.tf-article h2 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.025em; margin: 2.75rem 0 0.9rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--border); scroll-margin-top: 110px; }
.tf-article h3 { font-size: 1.12rem; font-weight: 700; margin: 1.9rem 0 0.6rem; scroll-margin-top: 110px; }
.tf-article h4 { font-size: 0.98rem; font-weight: 700; margin: 1.3rem 0 0.4rem; color: var(--text); }
.tf-article p { margin: 0 0 1rem; color: var(--text-muted); }
.tf-article ul, .tf-article ol { margin: 0.25rem 0 1.1rem 1.4rem; color: var(--text-muted); }
.tf-article li { margin-bottom: 0.35rem; }
.tf-article li > ul, .tf-article li > ol { margin-top: 0.35rem; margin-bottom: 0.35rem; }
.tf-article strong { color: var(--text); font-weight: 650; }
.tf-article a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.tf-article hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.tf-article code { font-family: 'JetBrains Mono', 'D2Coding', Consolas, monospace; font-size: 0.86em; background: var(--inline-code-bg); color: var(--inline-code-text); padding: 0.12em 0.4em; border-radius: 4px; word-break: break-word; }
.tf-article kbd { font-family: inherit; font-size: 0.8em; border: 1px solid var(--border-hi); border-bottom-width: 2px; border-radius: 4px; padding: 0.05em 0.4em; background: var(--bg-card); color: var(--text); }

.tf-code { margin: 1rem 0 1.5rem; border-radius: 10px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--border); }
.tf-code-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.6rem 0.4rem 1rem; background: var(--code-head); color: var(--code-dim); font-size: 0.75rem; font-family: 'JetBrains Mono', Consolas, monospace; }
.tf-code-head .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cbd5e1; }
.tf-code-head .lang { text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.tf-code-copy { border: 1px solid #334155; background: transparent; color: #cbd5e1; font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 5px; cursor: pointer; font-family: inherit; }
.tf-code-copy:hover { background: #334155; color: #fff; }
.tf-code pre { margin: 0; padding: 1rem 1.15rem; overflow-x: auto; color: var(--code-text); font-family: 'JetBrains Mono', 'D2Coding', Consolas, monospace; font-size: 0.84rem; line-height: 1.65; tab-size: 2; }
.tf-code pre code { background: none; color: var(--code-text); padding: 0; font-size: inherit; border-radius: 0; word-break: normal; }
.tf-code .c { color: #7f8ea3; }

.tf-callout { display: flex; gap: 0.7rem; padding: 0.9rem 1.1rem; border-radius: 10px; margin: 1rem 0 1.5rem; font-size: 0.92rem; border: 1px solid; }
.tf-callout .ico { flex-shrink: 0; line-height: 1.6; }
.tf-callout .body { color: var(--text-muted); min-width: 0; }
.tf-callout .body > *:last-child { margin-bottom: 0; }
.tf-callout .body p { margin-bottom: 0.5rem; }
.tf-callout .body strong.t { display: block; color: var(--text); margin-bottom: 0.15rem; }
.tf-callout.tip { background: var(--tip-bg); border-color: var(--tip-border); }
.tf-callout.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.tf-callout.info { background: var(--info-bg); border-color: var(--info-border); }
.tf-callout.danger { background: var(--danger-bg); border-color: var(--danger-border); }

.tf-table { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--border); border-radius: 10px; }
.tf-table table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tf-table th { background: var(--bg-soft); color: var(--text); font-weight: 650; text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tf-table td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: top; }
.tf-table tr:last-child td { border-bottom: 0; }

.tf-steps { list-style: none; margin: 0.5rem 0 1.5rem !important; counter-reset: s; }
.tf-steps > li { counter-increment: s; position: relative; padding: 0.85rem 1rem 0.85rem 3.1rem; margin-bottom: 0.6rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.tf-steps > li::before { content: counter(s); position: absolute; left: 0.9rem; top: 0.9rem; width: 24px; height: 24px; border-radius: 50%; background: var(--tool); color: #fff; font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.tf-goals { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; margin: 0 0 2rem; }
.tf-goals h4 { margin: 0 0 0.5rem !important; font-size: 0.82rem !important; letter-spacing: 0.04em; color: var(--text-dim) !important; text-transform: uppercase; }
.tf-goals ul { margin-bottom: 0 !important; }

.tf-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.tf-pager a { display: block; padding: 0.9rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); text-decoration: none !important; color: var(--text) !important; transition: border-color .15s, transform .15s; }
.tf-pager a:hover { border-color: var(--tool); transform: translateY(-1px); }
.tf-pager .dir { display: block; font-size: 0.74rem; color: var(--text-dim); margin-bottom: 0.15rem; }
.tf-pager .ttl { font-weight: 650; font-size: 0.92rem; }
.tf-pager .next { text-align: right; grid-column: 2; }

/* ── HUB / CARDS ─────────────────────────────────── */
.tf-wrap { max-width: 1320px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.tf-section { margin-bottom: 3rem; scroll-margin-top: 110px; }
.tf-section-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.tf-section-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.tf-section-head .count { font-size: 0.78rem; color: var(--text-dim); }
.tf-section > p.desc { color: var(--text-muted); font-size: 0.93rem; margin-bottom: 1.1rem; }

.tf-lessons { list-style: none; display: grid; gap: 0.6rem; margin: 0 !important; }
.tf-lessons a { display: grid; grid-template-columns: 2.4rem 1fr auto; gap: 0.9rem; align-items: center; padding: 0.95rem 1.1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); text-decoration: none !important; color: var(--text) !important; transition: border-color .15s; }
.tf-lessons a:hover { border-color: var(--tool); }
.tf-lessons .num { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 0.85rem; color: var(--tool); }
.tf-lessons .t { font-weight: 650; font-size: 0.95rem; display: block; }
.tf-lessons .d { font-size: 0.84rem; color: var(--text-muted); display: block; margin-top: 0.1rem; }
.tf-lessons .min { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }

.tf-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.15rem; border-radius: 9px; font-size: 0.88rem; font-weight: 650; text-decoration: none; border: 1px solid transparent; }
.tf-btn.primary { background: var(--tool); color: #fff; }
.tf-btn.primary:hover { filter: brightness(1.08); }
.tf-btn.ghost { border-color: var(--border-hi); color: var(--text); background: var(--bg-card); }
.tf-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* ── FOOTER ──────────────────────────────────────── */
footer.tf-footer { border-top: 1px solid var(--border); background: var(--bg-card); }
.tf-footer-inner { max-width: 1320px; margin: 0 auto; padding: 1.75rem 1.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-dim); }
.tf-footer-inner nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.tf-footer-inner a { color: var(--text-muted); text-decoration: none; }
.tf-footer-inner a:hover { color: var(--accent); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1180px) {
  .tf-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .tf-toc { display: none; }
}
@media (max-width: 900px) {
  .tf-layout, .tf-layout.no-toc { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 1.25rem; }
  .tf-side { position: static; max-height: none; order: 2; border-top: 1px solid var(--border); padding-top: 1.5rem; }
}
@media (max-width: 560px) {
  .tf-hero-inner, .tf-wrap, .tf-layout, .tf-footer-inner { padding-left: 1rem; padding-right: 1rem; }
  .tf-hero-inner { padding-top: 1.75rem; padding-bottom: 1.5rem; }
  .tf-pager { grid-template-columns: 1fr; }
  .tf-pager .next { grid-column: 1; }
  .tf-lessons a { grid-template-columns: 2.2rem 1fr; }
  .tf-lessons .min { display: none; }
  .tf-code pre { font-size: 0.8rem; }
  .tf-table table { min-width: 560px; }
}
