/* 글로 쓰는 가계도 홈페이지
   색은 도구(0.3판) 화면의 색을 그대로 씁니다. 외부 글꼴 없이 기기에 있는 한글 글꼴을 씁니다. */

:root {
  --bg: #eef1ef;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --ink: #18211f;
  --muted: #58645f;
  --line: #d6dedb;
  --paper-edge: #cfd8d4;
  --accent: #22614f;
  --accent-hover: #1a4d3f;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --boundary-fill: #f1f6f3;
  --risk: #b3261e;

  /* 도구의 입력창 색 표시와 같은 색 */
  --hl-kin: #d6e5ff;
  --hl-num: #e9e1ff;
  --hl-attr: #d6efdf;
  --hl-evt: #fde4c1;
  --hl-rel: #f9d6e1;
  --hl-neg: #e2e2e2;

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "D2Coding", monospace;

  --wrap: 1120px;
  --gutter: 24px;
  --radius-card: 16px;
  --radius-ctl: 10px;
  --radius-chip: 5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513;
    --surface: #171f1d;
    --surface-2: #1d2724;
    --ink: #e2eae7;
    --muted: #9aa8a4;
    --line: #2b3835;
    --paper-edge: #33423e;
    --accent: #6cc3a5;
    --accent-hover: #8fd3bb;
    --accent-ink: #0c1411;
    --accent-soft: #1d3a31;
    --boundary-fill: #13201c;
    --risk: #ff8a80;

    --hl-kin: #1e3558;
    --hl-num: #342a52;
    --hl-attr: #1b3d2b;
    --hl-evt: #4a3616;
    --hl-rel: #4b2231;
    --hl-neg: #343434;
  }
}

/* 기본 */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}

[hidden] { display: none !important; }
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 { margin: 0; color: var(--ink); }
p { margin: 0; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-ctl);
}
.skip:focus { top: 12px; }

/* 단추 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-ctl);
  border: 1px solid transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--accent); color: var(--ink); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 15px; }

/* 머리 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 36px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

/* 첫 화면 */
.hero { padding: 64px 0 72px; }
.hero-text {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px 56px;
  align-items: end;
}
.hero h1 {
  font-size: clamp(2.3rem, 5.6vw, 4.1rem);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.lead { font-size: 18px; color: var(--ink); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.cta-note { margin-top: 12px; font-size: 14px; color: var(--muted); }

.demo-strip {
  display: grid;
  grid-template-columns: minmax(0, 5fr) auto minmax(0, 6fr);
  align-items: center;
  gap: 20px;
  margin-top: 56px;
}

.record {
  margin: 0;
  padding: 22px 26px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.panel-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.record-text {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 18px;
  line-height: 2.05;
  white-space: pre-wrap;
  color: var(--ink);
}
mark {
  color: inherit;
  border-radius: var(--radius-chip);
  padding: 2px 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
mark.kin { background: var(--hl-kin); }
mark.num { background: var(--hl-num); }
mark.attr { background: var(--hl-attr); }
mark.evt { background: var(--hl-evt); }
mark.rel { background: var(--hl-rel); }
mark.neg { background: var(--hl-neg); }

/* 도구가 단어를 알아듣는 순서대로 색이 들어옴 */
.record.is-reading mark { animation: hl-in 0.4s ease-out backwards; }
@keyframes hl-in {
  from { background-color: transparent; }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.sw.kin { background: var(--hl-kin); }
.sw.num { background: var(--hl-num); }
.sw.attr { background: var(--hl-attr); }
.sw.evt { background: var(--hl-evt); }
.sw.rel { background: var(--hl-rel); }

.connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.connector svg { width: 64px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* 도구가 저장한 그림: 화면 색과 상관없이 흰 종이 */
.paper {
  margin: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
}
.strip-caption { margin-top: 14px; font-size: 14px; color: var(--muted); }

/* 구역 공통 */
.section { padding: 88px 0; background: var(--surface); }
.section-alt { background: var(--bg); }
.section h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 24em;
}
.section-lead { margin-top: 12px; color: var(--muted); max-width: 40em; }
.section h3 { font-size: 18px; line-height: 1.45; font-weight: 700; letter-spacing: -0.01em; }

/* 사용법 */
.how-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  margin-top: 40px;
  align-items: start;
}
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 28px 60px;
}
.steps li:last-child { padding-bottom: 0; }
/* 가계도 도형 안에 나이를 적듯, 네모 안에 순서를 적음 */
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  font-weight: 800;
  font-size: 17px;
  background: var(--surface);
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 42px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}
.steps p { margin-top: 4px; color: var(--muted); }

.video { margin: 0; }
.video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.video figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); }
.chapters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chapters button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.chapters button:hover { border-color: var(--accent); }

/* 알아듣는 표현 */
.expr {
  width: 100%;
  margin-top: 32px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.expr th {
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.expr td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: top; }
.expr tr:last-child td { border-bottom: 0; }
.expr td:first-child { width: 42%; }
.expr q { quotes: none; font-weight: 700; }
.expr q::before, .expr q::after { content: none; }

/* 정보 처리 */
.tool-quote {
  margin: 32px 0 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  max-width: 44em;
}
.tool-quote p { font-size: 20px; line-height: 1.6; font-weight: 600; }
.tool-quote footer { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* 가계도의 '동거가족' 점선 경계처럼, 브라우저 안을 점선으로 묶음 */
.boundary-diagram {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  grid-template-areas:
    "boundary outside"
    "kept kept";
  gap: 18px 0;
  align-items: center;
  margin-top: 44px;
}
.boundary {
  grid-area: boundary;
  position: relative;
  padding: 34px 28px 28px;
  border: 2px dashed var(--accent);
  border-radius: 36px;
  background: var(--boundary-fill);
}
.boundary-label {
  position: absolute;
  top: -0.85em;
  left: 28px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}
.flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.flow li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.flow li::after {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--ink);
}
.flow li:last-child::after { content: none; }
.flow-chip {
  display: inline-block;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
}

.outside {
  grid-area: outside;
  display: flex;
  align-items: center;
}
.cutoff { width: 76px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 2; }
.outside-box {
  display: inline-flex;
  flex-direction: column;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}
.outside-note { font-size: 13px; font-weight: 600; }

.kept {
  grid-area: kept;
  padding-left: 28px;
  font-size: 15px;
  color: var(--muted);
}
.kept strong { color: var(--ink); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 48px;
  margin: 48px 0 0;
}
.facts dt { font-weight: 700; font-size: 18px; }
.facts dd { margin: 4px 0 0; color: var(--muted); }

.note-box {
  margin-top: 40px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.note-box summary {
  padding: 16px 0;
  font-weight: 700;
  cursor: pointer;
}
.note-box p { margin-bottom: 14px; color: var(--muted); max-width: 48em; }
.code {
  margin: 0 0 14px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.site-privacy { margin-top: 24px; font-size: 14px; color: var(--muted); }
.online-note {
  margin-top: 40px;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  background: var(--boundary-fill);
  border-radius: 0 12px 12px 0;
  max-width: 52em;
}

/* 확인과 한계 */
.check-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  margin-top: 40px;
  align-items: start;
}
.ask-card { margin: 0; }
.ask-card img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.ask-card figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); }

.checkpoints { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.checkpoints li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: start; }
.checkpoints svg {
  width: 48px;
  height: 30px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  margin-top: 2px;
}
.checkpoints svg .zig { stroke: var(--risk); stroke-linejoin: round; }
.checkpoints svg .dash { stroke: var(--muted); stroke-dasharray: 3 2.4; }
.checkpoints svg text { fill: var(--muted); stroke: none; font-size: 12px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.checkpoints p { margin-top: 2px; color: var(--muted); }

.limits-box {
  margin-top: 48px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.limits-box ul { margin: 12px 0 0; padding-left: 1.2em; }
.limits-box li { margin-top: 6px; }
.limits-box li::marker { color: var(--muted); }

/* 판 기록 */
.filename { font-family: var(--mono); font-size: 15px; color: var(--ink); }
.releases { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 16px; }
.release {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.release.is-latest { border: 2px solid var(--accent); }
.release-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.release-version { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.release-meta { color: var(--muted); font-size: 15px; }
.release-badge {
  align-self: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}
.release-badge.is-stopped { background: var(--surface-2); color: var(--risk); border: 1px solid var(--line); }
.release.is-withdrawn { background: var(--surface-2); }
.release.is-withdrawn .release-version { color: var(--muted); }
.release-stopped { margin-top: 12px; color: var(--risk); font-weight: 600; }
.release-summary { margin-top: 10px; }
.release-changes { margin: 10px 0 0; padding-left: 1.2em; color: var(--muted); }
.release-changes li { margin-top: 4px; }
.release-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.release-sha { margin-top: 14px; font-size: 14px; color: var(--muted); }
.release-sha summary { cursor: pointer; }
.release-sha code {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* 내려받기 안내 */
.header-back { margin-left: auto; }
.get { padding: 64px 0 88px; }
.get-wrap { max-width: 760px; }
.get h1 {
  font-size: clamp(1.8rem, 4.4vw, 2.6rem);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.get-lead { margin-top: 14px; }
.get-note {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  font-size: 15px;
}
.get h2 { margin-top: 56px; margin-bottom: 24px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.get .steps h3 { font-size: 18px; line-height: 1.45; }
.get .steps li::before { background: var(--bg); }
.get .note-box { margin-top: 40px; }
.get .note-box code { font-family: var(--mono); font-size: 14px; }

/* 자주 묻는 질문 */
.faq { margin-top: 32px; border-top: 1px solid var(--line); max-width: 52em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  position: relative;
  list-style: none;
  padding: 18px 44px 18px 0;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { padding: 0 0 20px; color: var(--muted); max-width: 44em; }

/* 바닥 */
.site-footer {
  padding: 48px 0 56px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px 56px; }
.footer-grid p + p { margin-top: 8px; }
.footer-brand { font-weight: 800; font-size: 16px; color: var(--ink); }

/* 좁은 화면 */
@media (max-width: 960px) {
  .hero-text { grid-template-columns: 1fr; }
  .demo-strip { grid-template-columns: 1fr; gap: 14px; }
  .connector { flex-direction: row; justify-content: center; }
  .connector svg { transform: rotate(90deg); width: 40px; }
  .paper { max-width: 560px; justify-self: center; width: 100%; }
  .how-grid, .check-grid { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .site-nav { display: none; }
  .header-inner { justify-content: space-between; }
  .hero { padding: 40px 0 56px; }
  .lead { font-size: 17px; }
  .record { padding: 16px; }
  .record-text { font-size: 16px; padding: 12px 14px; }
  .section { padding: 64px 0; }
  .facts { grid-template-columns: 1fr; gap: 22px; }
  .boundary-diagram {
    grid-template-columns: 1fr;
    grid-template-areas: "boundary" "outside" "kept";
  }
  .flow { flex-direction: column; align-items: flex-start; gap: 0; }
  .flow li { flex-direction: column; align-items: flex-start; gap: 0; }
  .flow li::after { width: 2px; height: 16px; margin-left: 28px; }
  .outside { flex-direction: row; justify-content: flex-start; padding-left: 20px; }
  .kept { padding-left: 0; }
  .expr thead { display: none; }
  .expr, .expr tbody, .expr tr, .expr td { display: block; width: 100%; }
  .expr td:first-child { width: 100%; padding-bottom: 2px; border-bottom: 0; }
  .expr td:last-child { padding-top: 0; color: var(--muted); }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .record.is-reading mark { animation: none; }
  .faq summary::after { transition: none; }
}
