:root {
  --ink: #17243f;
  --muted: #697287;
  --paper: #f4f6fa;
  --white: #ffffff;
  --line: #cbd3e2;
  --shadow: 0 20px 70px rgb(25 38 66 / 12%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgb(94 119 183 / 13%), transparent 28rem),
    linear-gradient(145deg, #f8f9fc, #eef2f8);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #e49c46;
  outline-offset: 4px;
}

.page-shell {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.page-header {
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #7c6ced;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.guide {
  margin: 14px 0 0;
  color: var(--muted);
}

.chart-panel {
  overflow: hidden;
  border: 1px solid rgb(203 211 226 / 85%);
  border-radius: 28px;
  background: rgb(255 255 255 / 82%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.chart-scroll {
  overflow-x: auto;
  padding: clamp(34px, 6vw, 66px) 28px 54px;
}

.family-chart {
  width: max-content;
  min-width: 100%;
  text-align: center;
}

.family-chart ul {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 42px 0 0;
}

.family-chart .tree-root {
  padding-top: 0;
}

.organization-branch {
  position: relative;
  padding: 42px 18px 0;
  list-style: none;
}

.tree-root > .organization-branch {
  padding-top: 0;
}

.organization-branch::before,
.organization-branch::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 42px;
  border-top: 2px solid var(--line);
}

.organization-branch::after {
  right: auto;
  left: 50%;
  border-left: 2px solid var(--line);
}

.organization-branch:only-child::before,
.organization-branch:only-child::after,
.tree-root > .organization-branch::before,
.tree-root > .organization-branch::after {
  display: none;
}

.organization-branch:first-child::before,
.organization-branch:last-child::after {
  border: 0;
}

.organization-branch:last-child::before {
  border-right: 2px solid var(--line);
  border-radius: 0 12px 0 0;
}

.organization-branch:first-child::after {
  border-radius: 12px 0 0 0;
}

.organization-branch > ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 42px;
  border-left: 2px solid var(--line);
}

.organization-node {
  display: grid;
  gap: 18px;
  width: max-content;
  min-width: 250px;
  max-width: 680px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid #d8deea;
  border-radius: 22px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 12px 30px rgb(38 51 83 / 10%);
}

.organization-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.035em;
}

.organization-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.member-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.member-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 170px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid #dbe0eb;
  border-radius: 18px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 9px 24px rgb(38 51 83 / 8%);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.member-button:hover {
  transform: translateY(-4px);
  border-color: #aab5cc;
  box-shadow: 0 16px 30px rgb(38 51 83 / 14%);
}

.member-mark,
.profile-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--member-color);
  color: var(--member-ink, #fff);
  font-size: 1.25rem;
  font-weight: 850;
}

.member-text {
  display: grid;
  gap: 1px;
}

.member-text small {
  color: var(--muted);
  font-size: 0.75rem;
}

.member-text strong {
  font-size: 1.18rem;
  letter-spacing: -0.035em;
}

.member-coral { --member-color: #f0a078; --member-ink: #492014; }
.member-blue { --member-color: #6f9ee9; --member-ink: #102449; }
.member-violet { --member-color: #a88bf0; --member-ink: #291756; }
.member-navy { --member-color: #293e69; }
.member-mint { --member-color: #73cbbd; --member-ink: #123c36; }

.profile-dialog {
  width: min(500px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 30px 100px rgb(13 22 43 / 35%);
}

.profile-dialog::backdrop {
  background: rgb(15 24 43 / 58%);
  backdrop-filter: blur(5px);
}

.profile-card {
  position: relative;
  padding: 34px;
  border-radius: 24px;
  background: var(--white);
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f0f2f7;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.profile-mark {
  width: 66px;
  height: 66px;
  margin-bottom: 22px;
  border-radius: 21px;
  font-size: 1.55rem;
}

.profile-relation {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-card h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.profile-description {
  margin: 16px 0 26px;
  color: #4f5c75;
}

.profile-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-facts div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #f4f6fa;
}

.profile-facts dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-facts dd {
  margin: 0;
  font-weight: 650;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 1100px);
    padding: 38px 0 48px;
  }

  .chart-panel {
    border-radius: 20px;
  }

  .chart-scroll {
    padding: 30px 18px 42px;
  }

  .family-chart {
    min-width: 980px;
  }

  .member-button {
    width: 160px;
  }

  .profile-card {
    padding: 28px 24px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .member-button {
    transition: none;
  }
}
