@import url('https://fonts.googleapis.com/css2?family=Gamja+Flower&display=swap');

/* KittyWallet 프로젝트 테마 — 고양이 핑크 파스텔 라이트 */
/* Starlight --sl-color-* 변수 오버라이드 (Catppuccin @layer보다 높은 우선순위) */

:root[data-theme="dark"],
:root[data-theme="light"],
:root {
  color-scheme: light;

  /* Accent — KittyWallet Primary (#FDA5E3) */
  --sl-color-accent-low:  #FEE7F6;
  --sl-color-accent:      #FDA5E3;
  --sl-color-accent-high: #F77CCF;

  /* 텍스트 (어두운 쪽 → 밝은 쪽) */
  --sl-color-white:  #3D2E38;
  --sl-color-gray-1: #6F5B67;
  --sl-color-gray-2: #9B8792;
  --sl-color-gray-3: #C9BBC3;

  /* 구분선 / 테두리 */
  --sl-color-gray-4: #F4C8E4;
  --sl-color-gray-5: #F8DDF0;

  /* 패널 / 사이드바 배경 */
  --sl-color-gray-6: #FFF4FB;
  --sl-color-gray-7: #FEE7F6;

  /* 페이지 기본 배경 */
  --sl-color-black:  #FCE2F4;
}

#_top {
  word-break: keep-all;
  overflow-wrap: normal;
  letter-spacing: 0;
}

.kw-live-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 240px);
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  margin: 0 0 1.5rem;
  padding: clamp(1.1rem, 3vw, 1.75rem);
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 244, 251, 0.60)),
    radial-gradient(circle at 92% 12%, rgba(253, 165, 227, 0.32), transparent 24%),
    #FEE7F6;
  box-shadow: 0 10px 28px rgba(128, 72, 111, 0.08);
}

.kw-live-copy {
  min-width: 0;
}

.kw-live-kicker {
  margin: 0 0 0.45rem;
  color: #9F4A82;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kw-live-hero h2 {
  margin: 0;
  max-width: none;
  color: #3D2E38;
  font-family: 'Gamja Flower', sans-serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: nowrap;
}

.kw-live-hero p:not(.kw-live-kicker) {
  max-width: 36rem;
  margin: 0.85rem 0 0;
  color: #6F5B67;
  font-size: 1rem;
  line-height: 1.65;
}

.kw-live-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  margin-top: 1rem;
  padding: 0 1rem;
  border: 1px solid #F77CCF;
  border-bottom: 1px solid #F77CCF !important;
  border-radius: 999px;
  background: #FFFFFF;
  color: #3D2E38 !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  text-underline-offset: 0;
  box-shadow: 0 6px 14px rgba(128, 72, 111, 0.08) !important;
}

.kw-live-link span {
  display: block;
  transform: translateY(-1px);
}

.sl-markdown-content .kw-live-link,
.sl-markdown-content .kw-live-link:visited {
  color: #3D2E38 !important;
}

.kw-live-link:hover {
  background: #FEE7F6;
  color: #3D2E38 !important;
}

.kw-live-preview {
  justify-self: end;
  width: min(100%, 210px);
  max-height: 290px;
  overflow: hidden;
  border: 7px solid #FFFFFF;
  border-radius: 24px;
  background: #FCE2F4;
  box-shadow: 0 12px 26px rgba(128, 72, 111, 0.16);
}

.kw-live-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 390 / 844;
  object-fit: cover;
  object-position: top;
}

.kw-live-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  grid-auto-rows: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}

.kw-live-points div {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 5.5rem;
  margin-top: 0 !important;
  padding: 0.9rem;
  border: 1px solid #F4C8E4;
  border-radius: 12px;
  background: #FFFFFF;
}

.kw-live-points strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #F77CCF;
  font-size: 1.05rem;
}

.kw-live-points span {
  color: #4B3945;
  font-size: 0.92rem;
  line-height: 1.5;
}

.kw-live-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.kw-live-gallery figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 10px 24px rgba(128, 72, 111, 0.08);
}

.kw-live-phone {
  display: grid;
  place-items: start center;
  padding: 0.85rem 0.85rem 0;
  background: linear-gradient(180deg, rgba(254, 231, 246, 0.78), rgba(255, 255, 255, 0.3));
}

.kw-live-phone img {
  display: block;
  width: min(100%, 170px);
  max-height: 360px;
  aspect-ratio: 390 / 844;
  object-fit: cover;
  object-position: top;
  border: 5px solid #FFFFFF;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 10px 20px rgba(128, 72, 111, 0.14);
}

.kw-live-gallery figcaption {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
}

.kw-live-gallery figcaption strong {
  color: #3D2E38;
  font-size: 0.94rem;
}

.kw-live-gallery figcaption span {
  color: #6F5B67;
  font-size: 0.84rem;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .kw-live-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Architecture Page ── */

.kw-arch-img {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.25rem 0 0;
  border-radius: 10px;
}

.kw-arch-section {
  width: min(100%, 52rem);
  margin: 0 auto 1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 244, 251, 0.60)),
    radial-gradient(circle at 92% 12%, rgba(253, 165, 227, 0.28), transparent 24%),
    #FEE7F6;
  box-shadow: 0 10px 28px rgba(128, 72, 111, 0.08);
}

.kw-arch-kicker {
  margin: 0 0 0.55rem;
  color: #9F4A82;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kw-arch-lead {
  max-width: none;
  margin: 0 0 1.25rem;
  color: #3D2E38;
  font-family: 'Gamja Flower', sans-serif;
  font-size: clamp(1.8rem, 3.4vw, 2.55rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-arch-body {
  margin: 0;
  color: #6F5B67;
  font-size: 0.96rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.kw-arch-body + .kw-arch-body {
  margin-top: 0.65rem;
}

/* Diagrams */

.kw-arch-diagram,
.kw-flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0 0;
}

.kw-arch-node {
  width: 100%;
  max-width: 220px;
  padding: 0.65rem 1.1rem;
  border: 1px solid #F4C8E4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #3D2E38;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 3px 10px rgba(128, 72, 111, 0.07);
}

.kw-arch-connector,
.kw-flow-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  padding: 0.18rem 0;
  color: #FDA5E3;
  font-size: 1rem;
  line-height: 1;
}

.kw-arch-row {
  display: flex;
  align-items: center;
}

.kw-arch-link {
  padding: 0 0.45rem;
  color: #F4C8E4;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

.kw-arch-side {
  padding: 0.55rem 0.9rem;
  border: 1px dashed #F4C8E4;
  border-radius: 10px;
  background: rgba(254, 231, 246, 0.45);
  color: #9B8792;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.kw-flow-node {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  max-width: 220px;
  padding: 0.65rem 1.1rem;
  border: 1px solid #F4C8E4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #3D2E38;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(128, 72, 111, 0.07);
}

.kw-flow-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: #FDA5E3;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.sl-markdown-content pre.mermaid {
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background: transparent !important;
}

.sl-markdown-content pre.mermaid svg {
  width: 100% !important;
  max-width: 32rem !important;
  min-width: 0 !important;
  height: auto !important;
}

@media (max-width: 640px) {
  .sl-markdown-content pre.mermaid {
    align-items: flex-start !important;
    height: 16rem !important;
  }

  .sl-markdown-content pre.mermaid svg {
    width: 28rem !important;
    max-width: none !important;
    transform: scale(0.58);
    transform-origin: top center;
  }
}

/* Tech Stack Grid */

.kw-arch-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.75rem;
  width: min(100%, 52rem);
  margin: 0 auto 1rem;
}

.kw-standard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  margin: 1rem 0 0;
}

.kw-standard-subtitle {
  margin-top: 1.35rem;
}

.kw-arch-section table {
  width: 100%;
  margin: 1rem 0;
  border-color: #EAA8D2;
}

.kw-arch-section table th,
.kw-arch-section table td {
  border-color: #EAA8D2;
}

.kw-arch-section table thead {
  border-color: #D98BBC;
}

.kw-arch-section table tr {
  border-color: #EAA8D2;
}

.kw-standard-table-note {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(18rem, 1fr);
  align-items: center;
  gap: 0.85rem;
  margin: 1rem 0;
}

.kw-standard-table-note table {
  margin: 0;
}

.kw-standard-note-right {
  grid-template-columns: minmax(18rem, 1fr) minmax(0, 0.9fr);
  gap: 0.7rem;
}

.kw-standard-note-right table {
  justify-self: end;
}

.kw-standard-table-note .kw-arch-body {
  margin: 0;
}

.kw-arch-section pre {
  margin: 1rem 0;
}

.kw-arch-section pre:not(.mermaid) {
  border: 1px solid #F8DDF0 !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #3D2E38 !important;
}

.kw-arch-section pre:not(.mermaid) code {
  color: #3D2E38 !important;
  font-weight: 700;
}

.kw-arch-section .expressive-code pre {
  --code-background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid #F8DDF0 !important;
}

.kw-arch-section .expressive-code pre code,
.kw-arch-section .expressive-code pre .code,
.kw-arch-section .expressive-code pre span {
  color: #3D2E38 !important;
  font-weight: 700;
}

.kw-tech-section pre:not(.mermaid),
.kw-tech-section .expressive-code pre {
  white-space: pre-wrap !important;
}

.kw-tech-section table {
  display: table !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed;
}

.kw-tech-section table th,
.kw-tech-section table td {
  max-width: 0;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.kw-tech-section pre:not(.mermaid) code,
.kw-tech-section .expressive-code pre code,
.kw-tech-section .expressive-code pre .code,
.kw-tech-section .expressive-code pre span {
  white-space: pre-wrap !important;
  overflow-wrap: anywhere;
}

.kw-data-principles h3 {
  margin: 0.9rem 0 0.25rem;
  color: #4B3A45;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
}

.kw-arch-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  margin-top: 0 !important;
  box-sizing: border-box;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 6px 18px rgba(128, 72, 111, 0.08);
}

.kw-arch-tags {
  padding-top: 1rem;
}

@media (max-width: 640px) {
  .kw-arch-section,
  .kw-arch-stack {
    width: calc(100vw - 2rem);
  }

  .kw-arch-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .kw-standard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .kw-standard-grid {
    grid-template-columns: 1fr;
  }

  .kw-standard-table-note,
  .kw-standard-note-right {
    grid-template-columns: 1fr;
  }
}

.kw-arch-card .kw-arch-kicker {
  margin-bottom: 0.6rem;
}

.kw-arch-card-body {
  margin: 0 0 1rem;
  color: #6F5B67;
  font-size: 0.88rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* Retrospective */

.kw-retro-simple {
  border: 1px solid #F4C8E4;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 244, 251, 0.72)),
    #FEE7F6;
}

.kw-retro-copy {
  color: #6F5B67;
  font-size: 0.97rem;
  line-height: 1.82;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-retro-copy p {
  margin: 0;
}

.kw-retro-copy p + p {
  margin-top: 0.9rem;
}

.kw-retro-hero .kw-arch-body {
  max-width: 42rem;
  font-size: 1rem;
}

.kw-retro-stack {
  grid-auto-rows: 1fr;
}

.kw-retro-stack .kw-arch-card {
  min-height: 100%;
}

.kw-retro-stack .kw-arch-card-body {
  margin-bottom: 0;
  font-size: 0.94rem;
  line-height: 1.72;
}

.kw-retro-section .kw-arch-lead {
  margin-bottom: 0.9rem;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.kw-retro-question {
  margin: 0.85rem 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid #F77CCF;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: #3D2E38;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.62;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-retro-closing {
  border-color: #F77CCF;
}

.kw-retro-final {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #F4C8E4;
  color: #3D2E38;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-arch-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: auto;
  gap: 0.4rem;
}

.kw-arch-tag {
  padding: 0.22rem 0.65rem;
  border: 1px solid #F4C8E4;
  border-radius: 999px;
  background: rgba(254, 231, 246, 0.6);
  color: #6F5B67;
  font-size: 0.76rem;
  font-weight: 600;
}

.kw-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  grid-auto-rows: 1fr;
  gap: 0.75rem;
  width: min(100%, 52rem);
  margin: 0 auto 1rem;
}

.kw-template-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 9.5rem;
  height: 100%;
  margin-top: 0 !important;
  box-sizing: border-box;
  padding: 1rem;
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 6px 18px rgba(128, 72, 111, 0.08);
}

.kw-template-card strong {
  display: block;
  margin: 0 0 0.45rem;
  color: #3D2E38;
  font-size: 0.95rem;
  line-height: 1.35;
}

.kw-template-card span {
  display: block;
  color: #6F5B67;
  font-size: 0.88rem;
  line-height: 1.6;
}

.kw-template-table {
  width: 100%;
  margin: 1rem 0 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.kw-template-table th,
.kw-template-table td {
  padding: 0.7rem;
  border: 1px solid #EAA8D2;
  color: #4B3945;
  font-size: 0.86rem;
  line-height: 1.5;
  vertical-align: top;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-template-table th {
  background: rgba(254, 231, 246, 0.65);
  color: #9F4A82;
  font-weight: 800;
}

.kw-template-flow {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.kw-template-flow code,
.kw-template-inline-code {
  display: block;
  padding: 0.7rem 0.85rem;
  border: 1px solid #F8DDF0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: #3D2E38;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kw-template-copy pre:not(.mermaid),
.kw-template-copy .expressive-code pre {
  white-space: pre-wrap !important;
}

@media (max-width: 640px) {
  .kw-template-grid {
    grid-template-columns: 1fr;
    width: calc(100vw - 2rem);
  }
}

/* Principles */

.kw-arch-principles {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.kw-arch-principles li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #F8DDF0;
  color: #4B3945;
  font-size: 0.94rem;
  line-height: 1.55;
}

.kw-arch-principles li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kw-arch-principles li::before {
  content: "—";
  color: #FDA5E3;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .kw-arch-stack {
    grid-template-columns: 1fr;
  }

  .kw-arch-lead {
    font-size: clamp(1.36rem, 6.2vw, 1.65rem);
  }
}

/* ── Project Introduction ── */

.kw-intro {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(1.35rem, 4vw, 2.35rem);
  border: 1px solid #F4C8E4;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 244, 251, 0.60)),
    radial-gradient(circle at 92% 12%, rgba(253, 165, 227, 0.32), transparent 25%),
    #FEE7F6;
  box-shadow: 0 10px 28px rgba(128, 72, 111, 0.08);
}

.kw-intro-kicker {
  margin: 0 0 0.45rem;
  color: #9F4A82;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kw-intro-lead {
  max-width: none;
  margin: 0 0 1.25rem;
  color: #3D2E38;
  font-family: 'Gamja Flower', sans-serif;
  font-size: clamp(1.8rem, 3.4vw, 2.55rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.kw-intro-copy {
  color: #6F5B67;
  font-size: 1rem;
  line-height: 1.78;
}

.kw-intro-copy p {
  margin: 0;
}

.kw-intro-copy p + p {
  margin-top: 0.95rem;
}

.kw-intro-closing {
  margin: 1.5rem 0 0;
  padding: 1.15rem 0 0;
  border-top: 1px solid #F4C8E4;
  color: #3D2E38;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.6;
}

.kw-intro-baseline {
  margin: 1.35rem 0 0;
  color: #8F7885;
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: right;
}

@media (max-width: 760px) {
  .kw-live-points,
  .kw-live-gallery {
    grid-template-columns: 1fr;
  }

  .kw-live-hero {
    grid-template-columns: 1fr;
  }

  .kw-intro {
    padding: 1.2rem;
    border-radius: 14px;
  }

  .kw-intro-lead {
    max-width: none;
    font-size: clamp(1.36rem, 6.2vw, 1.65rem);
  }

  .kw-live-preview {
    justify-self: start;
    width: 160px;
    max-height: 210px;
  }

  .kw-live-hero {
    border-radius: 12px;
  }

  #_top {
    font-size: clamp(2rem, 8.2vw, 2.35rem);
    line-height: 1.16;
  }

  .kw-live-hero h2 {
    max-width: none;
    font-size: clamp(1.52rem, 6vw, 1.75rem);
    line-height: 1.15;
  }

  .kw-live-phone img {
    width: min(100%, 220px);
    max-height: 400px;
  }
}
