/* solution.html 도해 3장. 색은 NxSite.css 변수만 쓰고, 세 장은 그리는 방식을 일부러 다르게 둔다.
   1 구성 개요 = 허브와 칸 그림, 2 라이프사이클 = 번호 계단, 3 아키텍처 = 연결도. */

/* .px-fig 의 place-items:center 는 최근 크롬에서 block 자식에도 적용돼 폭이 줄어든다. 여기서 되돌린다 */
.px-fig.px-hub,
.px-fig.px-life,
.px-fig.px-arch {
  display: block;
  place-items: normal;
}

/* ===== 1. 구성 개요: 가운데 NxPortrait 에 네 역량이 붙는 허브(원본 구도 유지) ===== */
.px-hub {
  position: relative;
  isolation: isolate;
  padding: clamp(32px, 4.4vw, 64px) clamp(18px, 3vw, 44px);
}
.px-hub__rings {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(255, 255, 255, 0.055);
  stroke-width: 1;
}
.px-hub__rings circle:first-child {
  stroke: rgba(132, 198, 39, 0.2);
}
#pxHubArw path {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.6;
}
.px-hub__grid {
  --gap: clamp(36px, 4.4vw, 64px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: ". pb ." "io core ml" ". ev .";
  gap: var(--gap);
  align-items: center;
}
.px-hub__card--pb {
  grid-area: pb;
}
.px-hub__card--io {
  grid-area: io;
}
.px-hub__card--ml {
  grid-area: ml;
}
.px-hub__card--ev {
  grid-area: ev;
}
.px-hub__card {
  position: relative;
  padding: 20px 22px 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: var(--panel-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 28px 50px -30px rgba(0, 0, 0, 0.95);
  transition:
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease);
}
.px-hub__card:hover {
  border-color: var(--green-line);
  transform: translateY(-2px);
}
.px-hub__card p {
  margin-bottom: 16px;
  font-size: clamp(16px, 1.35vw, 18px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  color: var(--text);
}
.px-hub__vis {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.px-hub__core {
  grid-area: core;
  align-self: stretch;
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(120px, 12vw, 160px);
  border: 1.5px solid var(--green);
  border-radius: 18px;
  background: var(--ink);
}
.px-hub__core::before,
.px-hub__core::after {
  content: "";
  position: absolute;
  border-radius: 24px;
  pointer-events: none;
}
.px-hub__core::before {
  inset: -11px;
  border: 1px solid rgba(132, 198, 39, 0.34);
}
.px-hub__core::after {
  inset: -23px;
  border: 1px solid rgba(132, 198, 39, 0.14);
  border-radius: 30px;
}
.px-hub__word {
  font-family: "Zekton", var(--font);
  font-size: clamp(28px, 3.1vw, 44px);
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}
/* 코어로 이어지는 선: 초록 점선이 코어 쪽으로 흐른다(화면에 보일 때만) */
.px-hub__link {
  position: absolute;
  z-index: -1;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  --dash: repeating-linear-gradient(var(--dir), var(--green) 0 6px, transparent 6px 14px);
  background: var(--dash);
}
.px-hub__card--pb .px-hub__link {
  --dir: to bottom;
  left: calc(50% - 1px);
  top: 100%;
  width: 2px;
  height: var(--gap);
}
.px-hub__card--ev .px-hub__link {
  --dir: to top;
  left: calc(50% - 1px);
  bottom: 100%;
  width: 2px;
  height: var(--gap);
}
.px-hub__card--io .px-hub__link {
  --dir: to right;
  top: calc(50% - 1px);
  left: 100%;
  height: 2px;
  width: var(--gap);
}
.px-hub__card--ml .px-hub__link {
  --dir: to left;
  top: calc(50% - 1px);
  right: 100%;
  height: 2px;
  width: var(--gap);
}
.px-hub.is-live .px-hub__card--pb .px-hub__link {
  animation: px-hub-down 1.1s linear infinite;
}
.px-hub.is-live .px-hub__card--ev .px-hub__link {
  animation: px-hub-up 1.1s linear infinite;
}
.px-hub.is-live .px-hub__card--io .px-hub__link {
  animation: px-hub-right 1.1s linear infinite;
}
.px-hub.is-live .px-hub__card--ml .px-hub__link {
  animation: px-hub-left 1.1s linear infinite;
}
@keyframes px-hub-down {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 14px;
  }
}
@keyframes px-hub-up {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 -14px;
  }
}
@keyframes px-hub-right {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 14px 0;
  }
}
@keyframes px-hub-left {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -14px 0;
  }
}
/* 칸 안 그림 */
.px-hub__box {
  fill: var(--panel);
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1.2;
}
.px-hub__box.is-on {
  fill: #1b2712;
  stroke: var(--green);
  stroke-width: 1.5;
}
.px-hub__vis rect:not([class]) {
  fill: rgba(255, 255, 255, 0.13);
}
.px-hub__vis rect.is-on:not(.px-hub__box) {
  fill: var(--green);
}
.px-hub__wire {
  fill: none;
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 1.5;
}
.px-hub__wire.is-g {
  stroke: var(--green);
}
.px-hub__bus {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 2;
  stroke-linecap: round;
}
.px-hub__tap {
  fill: var(--panel-2);
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.4;
}
.px-hub__trig {
  fill: var(--green);
}
.px-hub__slot {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}
.px-hub__shade {
  fill: rgba(0, 0, 0, 0.5);
}
.px-hub__vis text {
  fill: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-anchor: middle;
}
.px-hub__vis--ml circle {
  fill: rgba(255, 255, 255, 0.42);
}
.px-hub__vis--ml circle.is-on {
  fill: var(--green);
}
.px-hub__vis--ml circle.is-far {
  fill: rgba(255, 255, 255, 0.16);
}
.px-hub__hull {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.2;
  stroke-dasharray: 3 4;
}
/* 나타날 때: 코어가 먼저, 네 칸이 차례로 */
.js .px-hub[data-reveal] .px-hub__card,
.js .px-hub[data-reveal] .px-hub__core {
  opacity: 0;
}
.js .px-hub.is-in .px-hub__core {
  animation: px-fade 0.7s ease both;
}
.js .px-hub.is-in .px-hub__card {
  animation: px-up 0.8s var(--ease) both;
}
.js .px-hub.is-in .px-hub__card--pb {
  animation-delay: 0.15s;
}
.js .px-hub.is-in .px-hub__card--ml {
  animation-delay: 0.25s;
}
.js .px-hub.is-in .px-hub__card--ev {
  animation-delay: 0.35s;
}
.js .px-hub.is-in .px-hub__card--io {
  animation-delay: 0.45s;
}

/* ===== 2. 라이프사이클: 번호 계단, 펼친 아코디언 단계가 초록 ===== */
.px-life {
  padding: clamp(22px, 3vw, 36px) clamp(18px, 2.6vw, 32px) clamp(14px, 2vw, 22px);
}
.px-life__steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 12px);
  height: clamp(280px, 30vw, 380px);
}
.px-life__steps > li {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
}
.px-life__steps > li:nth-child(1) {
  --h: 46%;
}
.px-life__steps > li:nth-child(2) {
  --h: 58%;
}
.px-life__steps > li:nth-child(3) {
  --h: 70%;
}
.px-life__steps > li:nth-child(4) {
  --h: 84%;
}
.px-life__steps > li:nth-child(5) {
  --h: 100%;
}
.px-life__bar {
  align-self: end;
  height: var(--h);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(10px, 1.2vw, 16px);
  border: 1px solid var(--line-2);
  border-radius: 12px 12px 4px 4px;
  background: var(--panel-2);
  color: var(--text-2);
  transform-origin: 50% 100%;
  transition:
    background-color 0.35s var(--ease),
    border-color 0.35s var(--ease),
    color 0.35s var(--ease);
}
.px-life__n {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.35s var(--ease);
}
.px-life__bar .px-ico {
  width: clamp(20px, 2vw, 28px);
  height: clamp(20px, 2vw, 28px);
}
.px-life__name {
  margin-top: 12px;
  font-size: clamp(13px, 1.15vw, 16px);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text-2);
  transition: color 0.35s var(--ease);
}
.px-life__steps > li.is-on .px-life__bar {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink);
}
.px-life__steps > li.is-on .px-life__n {
  color: var(--ink);
}
.px-life__steps > li.is-on .px-life__name {
  color: var(--text);
}
.px-life__back {
  position: relative;
  height: 54px;
  margin-top: 6px;
}
.px-life__back svg:first-child {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 34px;
  overflow: visible;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-dasharray: 4 5;
}
.px-life__back svg:first-child path {
  vector-effect: non-scaling-stroke;
}
.px-life__head {
  position: absolute;
  left: 10%;
  top: -4px;
  width: 12px;
  height: 9px;
  transform: translateX(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  overflow: visible;
}
.px-life__back span {
  position: absolute;
  left: 50%;
  top: 31px;
  transform: translate(-50%, -50%);
  padding: 0 12px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
/* 나타날 때: 계단이 1단부터 차례로 선다 */
@keyframes px-solart-y {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
.js .px-life[data-reveal] .px-life__bar {
  transform: scaleY(0);
}
.js .px-life.is-in .px-life__bar {
  animation: px-solart-y 0.7s var(--ease) both;
}
.js .px-life.is-in li:nth-child(2) .px-life__bar {
  animation-delay: 0.08s;
}
.js .px-life.is-in li:nth-child(3) .px-life__bar {
  animation-delay: 0.16s;
}
.js .px-life.is-in li:nth-child(4) .px-life__bar {
  animation-delay: 0.24s;
}
.js .px-life.is-in li:nth-child(5) .px-life__bar {
  animation-delay: 0.32s;
}

/* ===== 3. 아키텍처: 평면 연결도 + 설명 목록 ===== */
.px-arch {
  padding: clamp(18px, 2.6vw, 36px);
}
.px-arch__scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.px-arch__scroll:focus-visible {
  outline-offset: -2px;
}
.px-arch__svg {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
  font-family: var(--font);
}
.px-arch__svg text {
  fill: var(--text-2);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.px-arch__svg .px-ico-u {
  color: var(--muted);
}
.px-arch__zone rect {
  fill: rgba(255, 255, 255, 0.018);
  stroke: rgba(255, 255, 255, 0.4);
  stroke-dasharray: 6 6;
}
.px-arch__svg .px-arch__zone text {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.px-arch__node rect {
  fill: var(--panel-2);
  stroke: rgba(255, 255, 255, 0.4);
}
.px-arch__svg .px-arch__node text {
  fill: var(--text);
  font-weight: 650;
}
.px-arch__svg .px-arch__node .px-ico-u {
  color: var(--text-2);
}
.px-arch__core rect {
  fill: var(--ink);
  stroke: var(--green);
  stroke-width: 1.5;
}
.px-arch__svg .px-arch__core text {
  fill: var(--text);
  font-size: 18px;
  font-weight: 650;
}
.px-arch__svg .px-arch__core .px-arch__word {
  font-family: "Zekton", var(--font);
  font-size: 30px;
  font-weight: 400;
}
.px-arch__svg .px-arch__core .px-arch__eq {
  fill: var(--muted);
  font-size: 24px;
}
.px-arch__svg .is-g {
  fill: var(--green);
}
.px-arch__pylon > rect:first-child {
  fill: none;
  stroke: var(--green);
}
.px-arch__pylon > rect:not(:first-child) {
  fill: var(--panel-2);
  stroke: var(--line);
}
.px-arch__svg .px-arch__pylon text {
  font-size: 13px;
}
.px-arch__svg .px-arch__pylon .px-arch__cap {
  fill: var(--muted);
  font-weight: 700;
}
.px-arch__svg .px-arch__pylon .px-ico-u {
  color: var(--green);
}
.px-arch__svg .px-arch__who text {
  font-size: 14px;
}
.px-arch__svg .px-arch__who .px-arch__role {
  fill: var(--text);
  font-size: 17px;
  font-weight: 700;
}
.px-arch__svg .px-arch__who .px-ico-u {
  color: var(--text-2);
}
.px-arch__svg .px-arch__lbl text {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.px-arch__svg .px-arch__lbl .is-g {
  fill: var(--green);
}
.px-arch__ln {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1.5;
}
.px-arch__ln.is-g {
  stroke: var(--green);
  stroke-width: 2;
}
.px-arch__dot {
  fill: none;
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 1.5;
  stroke-dasharray: 1 5;
  stroke-linecap: round;
}
#pxArw path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.6;
}
#pxArwG path {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.8;
}
.px-arch__legend {
  margin-top: clamp(16px, 2vw, 24px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.px-arch__lt {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.px-arch__legend dl {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 32px;
}
.px-arch__legend dl > div {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 12px;
}
.px-arch__legend dt {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.px-arch__legend dd {
  font-size: 15px;
  color: var(--text-2);
}
.px-arch__legend sup {
  font-size: 0.7em;
}
/* 나타날 때: 연결선이 그어진다 */
.js .px-arch[data-reveal] .px-arch__ln {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.js .px-arch.is-in .px-arch__ln {
  animation: px-solart-draw 0.9s var(--ease) 0.15s both;
}
.js .px-arch.is-in .px-arch__ln.is-g {
  animation-delay: 0.55s;
}
@keyframes px-solart-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* 공통 아이콘(Tabler Icons, MIT). 선 굵기는 여기서 한 번만 정한다 */
.px-ico,
.px-ico-u {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.px-ico {
  display: block;
  flex: none;
}

/* 고대비(강제 색) 모드: 색이 바뀌어도 활성·사용 표시가 남도록 굵기와 윤곽선을 쓴다 */
@media (forced-colors: active) {
  .px-life__steps > li.is-on .px-life__bar {
    border-width: 3px;
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  .px-arch__svg text {
    fill: CanvasText;
  }
  .px-arch__ln,
  .px-arch__dot,
  .px-arch__svg rect,
  .px-hub__vis * {
    stroke: CanvasText;
  }
  .px-hub__link {
    forced-color-adjust: none;
    background: CanvasText;
  }
  .px-arch__ln.is-g,
  .px-arch__core rect {
    stroke: Highlight;
    stroke-width: 3;
  }
  .px-ico-u,
  .px-ico {
    color: CanvasText;
  }
}
/* 인쇄: 화면에 아직 안 들어온 도해도 다 그려진 상태로 */
@media print {
  .px-hub,
  .px-life,
  .px-arch,
  .px-hub *,
  .px-life *,
  .px-arch * {
    opacity: 1 !important;
    animation: none !important;
  }
  .px-life__bar {
    transform: none !important;
    animation: none !important;
  }
  .px-arch__ln {
    stroke-dashoffset: 0 !important;
  }
}

@media (max-width: 1023px) {
  .px-arch__legend dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 899px) {
  /* 좁은 화면: 코어를 위에 두고 네 칸을 2x2(600 미만은 한 줄)로. 연결선과 둥근 테는 뺀다 */
  .px-hub__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "core core" "io pb" "ev ml";
    gap: 14px;
  }
  .px-hub__core {
    min-height: 104px;
    margin: 14px 14px 22px;
  }
  .px-hub__link,
  .px-hub__rings {
    display: none;
  }
  .px-hub__card {
    padding: 16px;
  }
  .px-hub__vis {
    max-width: 320px;
  }
}
@media (max-width: 767px) {
  .px-life__steps {
    height: 250px;
  }
  .px-life__bar {
    border-radius: 8px 8px 3px 3px;
  }
  .px-life__bar .px-ico {
    display: none;
  }
  .px-life__name {
    font-size: 12px;
  }
  .px-life__back span {
    font-size: 13px;
  }
  .px-arch__legend dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 599px) {
  .px-hub__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "core" "io" "pb" "ev" "ml";
  }
}
