/* 소개 화면(/about). 색은 site.css 의 변수만 쓰므로 어두운 화면도 그대로 따른다. */
/* 단계 덱은 about.js 가 무대의 data-stage 값만 바꾸고, 아래 선택자가 그 값에 따라 요소를 차례로 켠다. */

/* 스크립트가 꺼져 있을 때 보이는 단계 목록 */
.how-steps {
  padding-left: 20px;
}

.how-steps li {
  margin-bottom: 12px;
}

.how-steps h3 {
  margin: 0 0 2px;
}

.how-steps p {
  margin: 0;
}

/* 덱의 틀: 단계 칩, 무대, 버튼, 설명 */
.deck {
  margin: 12px 0 8px;
  padding: 12px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.deck-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
}

.deck-nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.deck-nav .chip-n {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.deck-nav button[aria-current='step'] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.deck-nav button[aria-current='step'] .chip-n {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.deck-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.deck-caption {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.deck-count {
  padding-top: 2px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deck-caption h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.deck-caption p {
  margin: 0;
}

/* 무대. 위쪽 여백은 컴퓨터 바깥의 AI 서비스 상자가 쓴다 */
.stage {
  position: relative;
  margin-top: 12px;
  padding-top: 64px;
  font-size: 13px;
  line-height: 1.45;
}

.computer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1.25fr);
  gap: 8px;
  padding: 30px 14px 14px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  transition: border-color 0.5s;
}

.computer-label {
  position: absolute;
  top: 5px;
  right: 14px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.5s;
}

.computer-note {
  display: none;
  font-weight: 400;
}

.stage[data-stage='6'] .computer-note {
  display: inline;
}

/* 창 흉내: 대화창과 AIC 화면 */
.win {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--code-bg);
  color: var(--muted);
  font-size: 12px;
}

.dots {
  display: inline-flex;
  flex: none;
  gap: 4px;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.win-title {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.addr {
  min-width: 0;
  margin-left: auto;
  padding: 0 6px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  height: 300px;
}

/* 말풍선은 아래에서 쌓이고, 넘친 옛 말은 위로 밀려 가려진다 */
.msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24px);
  mask-image: linear-gradient(to bottom, transparent, #000 24px);
}

.msg {
  flex: none;
  max-width: 88%;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px;
  animation: about-in 0.5s ease both;
}

.msg.you {
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  background: var(--accent);
  color: var(--accent-text);
}

.msg.ai {
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  background: var(--surface);
}

/* AI 의 긴 글은 몇 줄만 보이고 아래로 흐려진다 */
.msg.wall {
  max-height: 8.5em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

.pick {
  display: block;
  width: fit-content;
  margin-bottom: 3px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--accent-text);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.stage[data-stage='1'] :is(.from-2, .from-3, .from-4, .from-5),
.stage[data-stage='2'] :is(.from-3, .from-4, .from-5),
.stage[data-stage='3'] :is(.from-4, .from-5),
.stage[data-stage='4'] .from-5 {
  display: none;
}

/* AI 서비스: 대화창 위, 컴퓨터 바깥. 대화창하고만 선으로 이어진다 */
.service {
  position: absolute;
  bottom: calc(100% + 40px);
  left: 12px;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  transition: border-color 0.5s, color 0.5s;
}

.service strong {
  display: block;
  font-size: 12px;
}

.service-note {
  display: none;
  font-size: 11px;
}

.stage[data-stage='6'] .service-note {
  display: block;
  animation: about-in 0.5s ease both;
}

.service::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  height: 40px;
  border-left: 2px dashed var(--border);
  transition: border-color 0.5s;
}

/* 가운데 화살표: 고른 것은 대화창으로, AI 의 고침은 화면으로 간다 */
.flow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.flow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-size: 11px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s;
}

.flow-item svg {
  width: 48px;
  height: 16px;
}

.arrow-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage[data-stage='3'] .to-chat,
.stage:is([data-stage='4'], [data-stage='5']) .to-screen {
  opacity: 1;
}

.screen {
  height: 300px;
}

/* 플러그인 줄: 2단계부터 스토리 목록 하나, 5단계부터 여럿이고 마인드맵이 켜진다 */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 29px;
  padding: 5px 8px 4px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  animation: about-in 0.5s ease both;
}

.stage[data-stage='1'] .tab,
.stage:is([data-stage='2'], [data-stage='3'], [data-stage='4']) :is(.tab-mind, .tab-more) {
  display: none;
}

.stage:is([data-stage='2'], [data-stage='3'], [data-stage='4']) .tab-story,
.stage:is([data-stage='5'], [data-stage='6']) .tab-mind {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.board {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 8px;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  transition: opacity 0.5s, visibility 0.5s;
}

.stage:not([data-stage='1']) .empty {
  opacity: 0;
  visibility: hidden;
}

.scenes {
  display: grid;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}

.stage:is([data-stage='2'], [data-stage='3'], [data-stage='4']) .scenes {
  opacity: 1;
  visibility: visible;
}

.scene {
  position: relative;
  padding: 5px 9px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: box-shadow 0.5s;
}

.scene b {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.scene span {
  display: block;
  font-size: 12.5px;
}

.scene-2 .after {
  display: none;
}

.stage[data-stage='4'] .scene-2 .before {
  display: none;
}

.stage[data-stage='4'] .scene-2 .after {
  display: block;
  animation: about-in 0.5s ease both;
}

/* 고른 장면의 테두리와 표시. 바뀐 표시는 잠깐 떴다가 사라진다 */
.stage:is([data-stage='3'], [data-stage='4']) .scene-2 {
  box-shadow: 0 0 0 2px var(--accent);
}

.stage[data-stage='4'] .scene-2 {
  animation: about-changed-bg 2.6s ease 0.3s both;
}

.scene em {
  position: absolute;
  top: 5px;
  right: 8px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.5s;
}

.picked {
  background: var(--accent);
  color: var(--accent-text);
}

.changed {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.stage[data-stage='3'] .picked {
  opacity: 1;
}

.stage[data-stage='4'] .changed {
  opacity: 1;
  animation: about-flash 2.6s ease 0.3s both;
}

.mindmap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}

.stage:is([data-stage='5'], [data-stage='6']) .mindmap {
  opacity: 1;
  visibility: visible;
}

.mm-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.mm-center {
  fill: var(--accent);
}

.mm-center-text {
  fill: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
}

.mm-node {
  fill: var(--surface);
  stroke: var(--border);
}

.mm-text {
  fill: var(--text);
  font-size: 13px;
}

.saved {
  margin: 0 8px 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.5s;
}

/* 6단계: 내 컴퓨터를 강조하고, 바깥으로 나가는 선은 대화창과 AI 서비스 사이뿐임을 보인다 */
.stage[data-stage='6'] .computer {
  border-color: var(--accent);
}

.stage[data-stage='6'] .computer-label {
  color: var(--accent);
}

.stage[data-stage='6'] .saved {
  opacity: 1;
}

.stage[data-stage='6'] .service {
  border-color: var(--accent);
  color: var(--text);
}

.stage[data-stage='6'] .service::after {
  border-left-color: var(--accent);
}

@keyframes about-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes about-flash {
  0% {
    opacity: 0;
  }
  15%,
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes about-changed-bg {
  0%,
  100% {
    background: var(--surface);
  }
  15%,
  70% {
    background: var(--ok-bg);
  }
}

/* 움직임을 줄이라는 설정이면 전환과 움직임을 모두 끄고 단계는 바로 바뀐다 */
@media (prefers-reduced-motion: reduce) {
  .stage,
  .stage *,
  .stage *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* 아래는 이 화면의 다른 칸 */
.plugin-examples {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.plugin-examples p {
  margin: 0;
}

.ai-note {
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
}

/* 좁은 화면: 무대의 두 창을 세로로 놓고 화살표를 위아래로 돌린다 */
@media (max-width: 600px) {
  .deck {
    padding: 10px 10px 12px;
  }

  .deck-nav button {
    padding: 3px 6px;
    font-size: 12px;
  }

  .computer {
    grid-template-columns: minmax(0, 1fr);
    padding: 30px 10px 10px;
  }

  .chat {
    height: 250px;
  }

  .screen {
    height: 290px;
  }

  .flow {
    flex-direction: row;
    gap: 28px;
    min-height: 48px;
  }

  .flow-item {
    flex-direction: row;
    gap: 4px;
  }

  .flow-item svg {
    transform: rotate(90deg);
  }

  .deck-caption {
    grid-template-columns: 36px 1fr;
    gap: 8px;
  }
}
