/* a2sys 법무 문서 페이지. 토큰과 서체는 루트 index.html 과 같은 값을 쓴다. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --blue:      #0052FF;
  --link:      #6E9BFF;   /* 어두운 바탕에서 본문 링크로 쓸 만큼 밝힌 값 */
  --bg:        #131620;
  --surface:   rgba(255, 255, 255, 0.05);
  --surface-h: rgba(255, 255, 255, 0.08);
  --border:    rgba(255, 255, 255, 0.11);
  --text:      #ECEEF4;
  --body:      #C9D0DE;   /* 긴 글을 읽는 본문색. --text 보다 한 단계 낮춘다 */
  --muted:     #A0AABF;
  --faint:     #757F9C;
  --w:         1120px;   /* 메인 페이지(index.html) 와 같은 값. 상단바의 로고·메뉴 위치가 맞으려면 같아야 한다 */
}

body {
  background: var(--bg);
  color: var(--body);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 3px; }

/* ─── 진행 표시 ─── */
#progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: var(--blue);
  z-index: 999;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ─── 헤더 ─── */
header {
  position: sticky; top: 0;
  z-index: 100;
  transition: background 0.3s, border-color 0.3s;
}

/* 맨 위에서는 투명하고 스크롤하면 배경이 생긴다. 메인 페이지의 상단바와 같은 동작이다. */
header.scrolled {
  background: rgba(6, 6, 14, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.head-inner {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.head-brand { display: flex; align-items: center; gap: 16px; }
/* display 를 지정하지 않아 인라인으로 둔다. 메인 페이지의 로고가 인라인이라
   baseline 여백 4px 을 안고 2px 위로 올라가는데, 두 상단바를 겹쳐 보면
   그 차이가 드러나므로 같은 조건으로 맞춘다. */
.logo { height: 36px; width: auto; overflow: visible; }
/* 상단 메뉴와 같은 글꼴·크기를 쓴다. 왼쪽 선은 로고와 갈라 주는 구분자다. */
.head-tag {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
  transition: color 0.2s;
}
.head-tag:hover { color: var(--text); text-decoration: none; }

/* 메인 페이지(index.html)와 같은 상단 메뉴 */
.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--text); padding: 4px;
}
#mob-menu {
  display: none;
  flex-direction: column;
  padding: 12px 28px 22px;
  gap: 0;
  border-top: 1px solid var(--border);
  background: rgba(6, 6, 14, 0.96);
}
#mob-menu.open { display: flex; }
#mob-menu a {
  padding: 12px 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
#mob-menu a:hover { color: var(--text); text-decoration: none; }
#mob-menu a:last-child { border-bottom: none; color: var(--blue); font-weight: 600; }

/* ─── 2단 레이아웃 ─── */
main { padding: 56px 0 96px; }
.shell {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 72px;
  align-items: start;
}

/* ─── 사이드바 ─── */
.rail { position: sticky; top: 96px; }
.toc-h {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.toc {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding-right: 8px;
}
.toc ol { list-style: none; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.toc a:hover { color: var(--text); text-decoration: none; border-left-color: var(--faint); }
.toc a.active { color: var(--text); border-left-color: var(--blue); font-weight: 600; }

/* 목차가 있을 때만 구분선을 둔다. 허브에는 목차가 없다. */
.toc + .switch { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.switch a {
  display: block;
  padding: 7px 0;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}
.switch a:hover { color: var(--text); text-decoration: none; }
.switch a.on { color: var(--text); font-weight: 600; }
.switch a.on::before { content: "▸ "; color: var(--blue); }

/* ─── 본문 ─── */
article { max-width: 748px; }
.crumb { font-size: 0.8125rem; color: var(--faint); margin-bottom: 18px; }
.crumb a { color: var(--muted); }
.crumb span { margin: 0 7px; opacity: 0.5; }

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
.updated {
  margin-top: 14px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

article section { margin-top: 48px; }
article section:first-of-type { margin-top: 40px; }

h2 {
  position: relative;
  scroll-margin-top: 96px;
  margin-bottom: 18px;
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
}
.anchor {
  position: absolute;
  left: -1.4em;
  color: var(--faint);
  opacity: 0;
  font-weight: 500;
  transition: opacity 0.15s;
}
h2:hover .anchor { opacity: 1; }
.anchor:hover { text-decoration: none; color: var(--blue); }

article p { margin-bottom: 16px; line-height: 1.75; }
article p:last-child { margin-bottom: 0; }
article strong { color: var(--text); font-weight: 600; }

.addr {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.7;
}

article ul { margin: 0 0 16px; padding-left: 22px; }
article li { margin-bottom: 10px; line-height: 1.75; }
article li::marker { color: var(--faint); }

/* 번호가 붙은 항. 번호를 왼쪽에 걸어 본문이 한 줄로 맞게 시작하도록 한다. */
ol.clauses { list-style: none; margin: 0 0 16px; padding: 0; }
ol.clauses > li { position: relative; padding-left: 3.2em; margin-bottom: 16px; }
ol.clauses > li:last-child { margin-bottom: 0; }
ol.clauses > li > p { margin-bottom: 12px; }
ol.clauses > li > p:last-child { margin-bottom: 0; }
ol.clauses .cn {
  position: absolute; left: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ─── 표 ─── */
.tablewrap { overflow-x: auto; margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}
th {
  color: var(--text);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--faint);
}
td .sub { color: var(--faint); font-size: 0.875em; }
/* 아직 적을 항목이 없는 표의 한 행. 표의 열 구성은 그대로 보이게 둔다. */
td.empty { color: var(--muted); }

/* ─── 허브 카드 ─── */
.cards { display: grid; gap: 14px; margin-top: 28px; }
.card {
  display: block;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.card:hover {
  background: var(--surface-h);
  border-color: rgba(0, 82, 255, 0.45);
  transform: translateY(-2px);
  text-decoration: none;
}
.card-t { display: block; font-size: 1.0625rem; font-weight: 700; color: var(--text); }
.card-d { display: block; margin-top: 7px; font-size: 0.9375rem; color: var(--muted); line-height: 1.6; }
.card-u { display: block; margin-top: 12px; font-size: 0.8125rem; color: var(--faint); }

/* ─── 맨 위로 ─── */
.totop {
  position: fixed;
  right: 28px; bottom: 28px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 6, 14, 0.9);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  z-index: 90;
}
.totop.show { opacity: 1; pointer-events: auto; }
.totop:hover { color: var(--text); border-color: var(--faint); text-decoration: none; }

/* ─── 푸터 ─── */
footer { border-top: 1px solid var(--border); padding: 36px 28px; }
.foot-inner {
  max-width: var(--w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* 좁아지면 두 링크가 저작권 표기 아래로 내려간다. */
.foot-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
}
.foot-copy { font-size: 0.8125rem; color: var(--faint); }
.foot-links { font-size: 0.8125rem; }
.foot-links a { color: var(--muted); font-weight: 500; white-space: nowrap; }
.foot-links a:hover { color: var(--text); }
.foot-biz { font-size: 0.75rem; color: var(--faint); line-height: 1.6; }
.foot-biz .fl { color: var(--muted); font-weight: 500; margin-right: 5px; }
.foot-biz .kr { font-weight: 400; opacity: 0.72; }
.foot-links .sep, .foot-biz .sep { margin: 0 10px; opacity: 0.4; }

/* ─── 반응형 ─── */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; gap: 36px; }
  /* 좁은 화면에서는 제목을 먼저 읽히고 목차를 그 아래에 둔다. */
  article { order: 1; max-width: none; }
  .rail {
    order: 2;
    position: static;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .toc { max-height: 320px; }
  .toc + .switch { margin-top: 22px; padding-top: 18px; }
  .anchor { display: none; }
}

/* 메인(index.html)과 같은 폭에서 상단 메뉴를 감추고 햄버거를 보인다 */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: block; }
}

@media (max-width: 620px) {
  main { padding: 36px 0 72px; }
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.1875rem; }
  .totop { right: 16px; bottom: 16px; }
}
