/*
 * 핵클 문서 사이트 스타일
 * 색은 GitBook 사이트(docs.hackle.io)에서 실제로 그려지는 값에 맞춘다.
 * 브랜드, 제목, 본문 색은 documentation.json의 colors에서 정한다.
 */

/* 배경: 라이트는 흰색, 다크는 GitBook과 같은 #1D1D1D */
:root {
  --navbar-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --content-bg: #ffffff;
  --footer-border: #e3e6ea;
  --toc-text: #6a6e75;
  --toc-active-text: #0c408d;
}

.dark {
  --brand-text: #ffffff;
  --navbar-bg: #1d1d1d;
  --sidebar-bg: #1d1d1d;
  --content-bg: #1d1d1d;
  --footer-border: #383a3b;
  --toc-text: #bec0c4;
  --toc-active-text: #4f84d7;
}

/*
 * 사이드바에서 숨기는 문서(GitBook에서 숨김이던 페이지): documentation.json 내비게이션에는 두어 주소로는 열리지만, 사이드바 목록에는 보이지 않는다.
 * 사이드바 항목은 <a class="dai-sidebar-page" href="/경로">로 그려지므로 경로로 골라 숨긴다.
 * 숨길 문서를 더할 때는 아래 선택자에 경로를 한 줄 추가한다.
 * 지금 보고 있는 문서(.dai-sidebar-page-active)는 숨기지 않아서, 그 문서를 열면 사이드바에 위치가 보인다.
 */
a.dai-sidebar-page[href="/pre-setting/cash/message-pricing"]:not(.dai-sidebar-page-active) {
  display: none;
}

/*
 * Admin API: HTTP API 아래 하위 그룹의 제목과 그 안의 페이지를 숨긴다. 한국어(/)와 영문(/en/) 모두 같은 구조다.
 * Admin API 문서 중 하나를 보고 있을 때는 그룹 제목과 페이지를 모두 보여준다.
 */
.dai-sidebar:not(:has(a.dai-sidebar-page-active[href^="/hackle-admin-api/admin-api/"], a.dai-sidebar-page-active[href^="/en/hackle-admin-api/admin-api/"])) .dai-sidebar-page-group-title[title="Admin API"],
.dai-sidebar:not(:has(a.dai-sidebar-page-active[href^="/hackle-admin-api/admin-api/"], a.dai-sidebar-page-active[href^="/en/hackle-admin-api/admin-api/"])) a.dai-sidebar-page[href^="/hackle-admin-api/admin-api/"],
.dai-sidebar:not(:has(a.dai-sidebar-page-active[href^="/hackle-admin-api/admin-api/"], a.dai-sidebar-page-active[href^="/en/hackle-admin-api/admin-api/"])) a.dai-sidebar-page[href^="/en/hackle-admin-api/admin-api/"] {
  display: none;
}

/*
 * 표: GitBook처럼 표를 본문 폭에 맞추고, <th width>가 있는 열은 그 너비를 쓰고 나머지 열은 남은 폭을 똑같이 나눈다.
 * 기본 스타일은 칸 너비를 120~250px로 제한하고 내용 길이로 열 너비를 정해서 width 값이 반영되지 않는다.
 * 너비 합이 본문보다 넓으면 GitBook처럼 가로로 스크롤된다.
 */
article.dai-article table {
  table-layout: fixed;
  width: 100%;
}

article.dai-article th,
article.dai-article td {
  min-width: 0;
  max-width: none;
}

/*
 * 버전 뱃지(img.shields.io): GitBook처럼 글자 높이의 인라인 이미지로 그린다.
 * 본문 이미지 기본 스타일(블록, 위아래 여백, 둥근 모서리)을 덮어쓴다.
 */
.dai-article img[src^="https://img.shields.io/"] {
  display: inline-block;
  width: auto;
  height: 20px;
  margin: 0 4px 0 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  vertical-align: middle;
}

/*
 * 히어로(snippets/hero.jsx의 HomeHero): 왼쪽 위에 설명·버튼, 오른쪽에 제품 이미지.
 */
.hk-hero {
  --hk-hero-accent: #2f6fed;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin: 8px 0 48px;
}

.hk-hero-text {
  min-width: 0;
}

.dai-article .hk-hero-description {
  margin: 0 0 28px;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.65;
  word-break: keep-all;
}

.dai-article .hk-hero-description em {
  font-style: normal;
  font-weight: 700;
  background: linear-gradient(90deg, #2f6fed, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hk-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dai-article a.hk-hero-button {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
}

.dai-article a.hk-hero-button.is-primary {
  border-color: var(--hk-hero-accent);
  background: var(--hk-hero-accent);
  color: #ffffff;
}

.dai-article a.hk-hero-button:hover {
  opacity: 0.88;
}

.hk-hero-media {
  justify-self: end;
  width: 100%;
  max-width: 480px;
  min-width: 0;
}

.dai-article .hk-hero-media img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 960px) {
  .hk-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .hk-hero-media {
    justify-self: start;
  }
}

/*
 * 기능 카드(snippets/hero.jsx의 HomeFeatures): AI·실험·데이터 분석·CRM 마케팅.
 * 카드 위쪽 그림 영역은 평소에 옅은 색만 보이고, 마우스를 올리면 일러스트가 나타난다.
 */
/* 사이트의 라이트·다크 클래스에 기대지 않도록 색은 글자색(currentColor)과 섞어서 만든다 */
.hk-feat {
  margin: 0 0 24px;
}

.hk-feat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dai-article a.hk-feat-card {
  --hk-c: #2f6fed;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 14px;
  background: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dai-article a.hk-feat-card.is-ai { --hk-c: #8b5cf6; }
.dai-article a.hk-feat-card.is-experiment { --hk-c: #2f6fed; }
.dai-article a.hk-feat-card.is-analytics { --hk-c: #0ea5a4; }
.dai-article a.hk-feat-card.is-crm { --hk-c: #f97316; }

.dai-article a.hk-feat-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--hk-c) 55%, transparent);
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--hk-c) 45%, transparent);
}

.hk-feat-visual {
  position: relative;
  display: block;
  height: 160px;
  border: 0;
  flex: none;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--hk-c) 22%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--hk-c) 10%, transparent), color-mix(in srgb, var(--hk-c) 4%, transparent));
}

/* 좌상단 제목과 겹치지 않도록 일러스트는 제목 아래 공간에 그린다 */
.hk-feat-art {
  position: absolute;
  top: 40px;
  right: 0;
  bottom: 6px;
  left: 0;
  width: 100%;
  height: calc(100% - 46px);
  transform-origin: center bottom;
  transition: transform 0.3s ease;
}

.hk-feat-card:hover .hk-feat-art,
.hk-feat-card:focus-visible .hk-feat-art {
  transform: scale(1.08);
}

.hk-art-soft { fill: color-mix(in srgb, var(--hk-c) 16%, transparent); }
.hk-art-panel { fill: color-mix(in srgb, var(--hk-c) 6%, transparent); stroke: color-mix(in srgb, var(--hk-c) 35%, transparent); }
.hk-art-strong { fill: var(--hk-c); }
.hk-art-strong.is-70 { opacity: 0.7; }
.hk-art-strong.is-45 { opacity: 0.45; }
.hk-art-strong.is-25 { opacity: 0.25; }
.hk-art-line { fill: color-mix(in srgb, var(--hk-c) 45%, transparent); }
.hk-art-white { fill: #ffffff; opacity: 0.92; }
.hk-art-accent { fill: var(--hk-c); }
.hk-art-stroke { fill: none; stroke: var(--hk-c); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.hk-art-check { fill: none; stroke: var(--hk-c); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.hk-art-label { font: 700 14px/1 -apple-system, sans-serif; fill: var(--hk-c); }
.hk-art-label.is-white { fill: #ffffff; }

.hk-feat-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 14px 16px 18px;
}

.hk-feat-title {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
}

.hk-feat-arrow {
  color: var(--hk-c);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hk-feat-card:hover .hk-feat-arrow,
.hk-feat-card:focus-visible .hk-feat-arrow {
  opacity: 1;
  transform: none;
}

.hk-feat-description {
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.7;
  word-break: keep-all;
}

@media (max-width: 1100px) {
  .hk-feat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hk-feat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*
 * 개발 가이드 히어로(snippets/dev-hero.jsx의 DevHero).
 * 서비스 가이드 히어로(.hk-hero)를 그대로 쓰고, 오른쪽 이미지 대신 코드 창(.hk-code)을 둔다.
 */
.hk-hero.is-dev {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
}

/* 연동 3단계: 번호 원 + 제목, 설명 (오른쪽 코드 창 주석 1~3과 짝) */
.dai-article ol.hk-steps {
  display: grid;
  gap: 14px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.dai-article li.hk-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 0;
}

/* 스텝처럼 번호 원 사이를 세로선으로 잇는다 (원 아래부터 다음 항목의 원 위까지, 항목 간격 14px 포함) */
.dai-article li.hk-step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: -10px;
  left: 12px;
  width: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, #2f6fed 22%, transparent);
}

.hk-step-number {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, #2f6fed 14%, transparent);
  color: #2f6fed;
  font-size: 13px;
  font-weight: 700;
}

.hk-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  line-height: 1.5;
}

.hk-step-text span {
  opacity: 0.7;
}

/* 코드 창은 라이트·다크 모두 어두운 편집기 색으로 그린다 */
.hk-code {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #0f172a;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
}

.hk-code-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.hk-code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

/* 탭 전환: 숨긴 라디오 버튼이 선택되면 같은 키의 탭을 강조하고 코드를 보여 준다 */
.hk-code-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hk-code-tabs {
  display: flex;
  gap: 2px;
  margin-left: 10px;
}

.hk-code-tab {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.55);
  cursor: pointer;
  user-select: none;
}

.hk-code-tab:hover {
  color: #e2e8f0;
}

.hk-code-radio.is-js:checked ~ .hk-code-bar .hk-code-tab.is-js,
.hk-code-radio.is-android:checked ~ .hk-code-bar .hk-code-tab.is-android,
.hk-code-radio.is-ios:checked ~ .hk-code-bar .hk-code-tab.is-ios {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.hk-code-radio:focus-visible ~ .hk-code-bar .hk-code-tabs {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
  border-radius: 6px;
}

.hk-code-body {
  display: none;
}

.hk-code-radio.is-js:checked ~ .hk-code-body.is-js,
.hk-code-radio.is-android:checked ~ .hk-code-body.is-android,
.hk-code-radio.is-ios:checked ~ .hk-code-body.is-ios {
  display: block;
}

.hk-code-body {
  overflow-x: auto;
  padding: 16px 18px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  /* 탭마다 줄 수가 달라도 창 높이가 바뀌지 않도록 가장 긴 탭(13줄)에 맞춘다 */
  min-height: calc(13 * 1.7em);
}

.hk-code-line {
  white-space: pre;
}

.hk-code-kw { color: #c084fc; }
.hk-code-fn { color: #60a5fa; }
.hk-code-str { color: #86efac; }
.hk-code-cm { color: #64748b; }

@media (max-width: 960px) {
  .hk-hero.is-dev {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*
 * 링크로 감싼 버전 뱃지: 링크 밑줄이 뱃지 옆 여백까지 그려져 "_"처럼 보이지 않도록 밑줄을 없앤다.
 */
.dai-article a:has(> img[src^="https://img.shields.io/"]) {
  text-decoration: none;
  border-bottom: 0;
  background-image: none;
  box-shadow: none;
}

.dai-article a > img[src^="https://img.shields.io/"] {
  margin-right: 0;
}

/*
 * 콜아웃(<Callout kind="...">): GitBook(docs.hackle.io)의 hint 블록과 같게 그린다.
 * - 배경은 종류별 옅은 색, 아이콘만 종류별 진한 색, 본문 글자는 일반 본문 색
 * - 글자 14px, 줄 높이 20px, 안쪽 여백 16px, 아이콘과 본문 사이 12px, 모서리 12px
 * - 아이콘은 GitBook과 같은 Font Awesome 모양(정보·경고·위험·성공)으로 바꾼다
 * 기본 스타일은 본문 글자까지 종류별 색으로 칠하고, 안쪽 요소의 margin을 모두 0으로 만든다.
 * kind와 GitBook hint의 대응: info → 정보, alert → 경고, danger → 위험, success → 성공 (tip은 정보와 같게)
 * 색은 GitBook에서 실제로 그려지는 값이다. 다만 다크 테마의 정보(GitBook은 회색)는 파란색, 성공(GitBook은 파란색)은 초록색으로 바꿨다.
 */
:root {
  --hk-hint-text: #1d1d1d;
  --hk-hint-info-bg: #f0f8ff;
  --hk-hint-info-icon: #0051cc;
  --hk-hint-warning-bg: #fff5ec;
  --hk-hint-warning-icon: #fe9a00;
  --hk-hint-danger-bg: #fff2ef;
  --hk-hint-danger-icon: #fb2c36;
  --hk-hint-success-bg: #eefcf0;
  --hk-hint-success-icon: #00c950;
}

.dark {
  --hk-hint-text: #ffffff;
  --hk-hint-info-bg: #262c36;
  --hk-hint-info-icon: #418aff;
  --hk-hint-warning-bg: #322a23;
  --hk-hint-warning-icon: #fe9a00;
  --hk-hint-danger-bg: #372726;
  --hk-hint-danger-icon: #fb2c36;
  --hk-hint-success-bg: #23302a;
  --hk-hint-success-icon: #00c950;
}

[data-component="Callout"] {
  --hk-hint-bg: var(--hk-hint-info-bg);
  --hk-hint-icon: var(--hk-hint-info-icon);
  --hk-hint-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24l80 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-8 0 0-88c0-13.3-10.7-24-24-24l-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l24 0 0 64-24 0zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z'/></svg>");
  padding: 16px;
  border-radius: 12px;
  background-color: var(--hk-hint-bg);
}

[data-component="Callout"][data-kind="alert"] {
  --hk-hint-bg: var(--hk-hint-warning-bg);
  --hk-hint-icon: var(--hk-hint-warning-icon);
  --hk-hint-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-464a208 208 0 1 0 0 416 208 208 0 1 0 0-416zm0 336a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0-256c18.2 0 32.7 15.5 31.4 33.7l-7.4 104c-.9 12.6-11.4 22.3-23.9 22.3-12.6 0-23-9.7-23.9-22.3l-7.4-104C223.3 143.5 237.8 128 256 128z'/></svg>");
}

[data-component="Callout"][data-kind="danger"] {
  --hk-hint-bg: var(--hk-hint-danger-bg);
  --hk-hint-icon: var(--hk-hint-danger-icon);
  --hk-hint-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256.5 0c14.7 0 28.2 8.1 35.2 21l216 400c6.7 12.4 6.4 27.4-.8 39.5S486.6 480 472.5 480l-432 0c-14.1 0-27.1-7.4-34.3-19.5s-7.5-27.1-.8-39.5l216-400c7-12.9 20.5-21 35.2-21zM53.9 432L459.1 432 256.5 56.8 53.9 432zm202.6-40a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0-208c18.6 0 33 16.1 31 34.6l-7.1 64.1C279 294.8 268.7 304 256.5 304s-22.5-9.2-23.8-21.3l-7.1-64.1c-2-18.5 12.4-34.6 31-34.6z'/></svg>");
}

[data-component="Callout"][data-kind="success"] {
  --hk-hint-bg: var(--hk-hint-success-bg);
  --hk-hint-icon: var(--hk-hint-success-icon);
  --hk-hint-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-464a208 208 0 1 0 0 416 208 208 0 1 0 0-416zm70.7 121.9c7.8-10.7 22.8-13.1 33.5-5.3 10.7 7.8 13.1 22.8 5.3 33.5L243.4 366.1c-4.1 5.7-10.5 9.3-17.5 9.8-7 .5-13.9-2-18.8-6.9l-55.9-55.9c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l36 36 105.6-145.2z'/></svg>");
}

[data-component="Callout"] > div {
  gap: 12px;
}

/* 아이콘: 기본 아이콘을 숨기고 GitBook 아이콘을 마스크로 그린다 (글자 크기의 1.2배, 첫 줄 가운데) */
[data-component="Callout"] .dai-callout-icon {
  height: 20px;
}

[data-component="Callout"] .dai-callout-icon svg {
  display: none;
}

[data-component="Callout"] .dai-callout-icon::before {
  content: "";
  display: block;
  width: 16.8px;
  height: 16.8px;
  background-color: var(--hk-hint-icon);
  -webkit-mask: var(--hk-hint-mask) center / contain no-repeat;
  mask: var(--hk-hint-mask) center / contain no-repeat;
}

/* 본문: 종류별 글자색을 없애고 14px/20px 본문 색으로, 블록 사이는 GitBook처럼 12px */
[data-component="Callout"] .dai-callout-body {
  font-size: 14px;
  line-height: 20px;
  color: var(--hk-hint-text);
}

[data-component="Callout"][data-kind] .dai-callout-body p,
[data-component="Callout"][data-kind] .dai-callout-body li {
  font-size: 14px !important;
  line-height: 20px !important;
  color: var(--hk-hint-text) !important;
}

[data-component="Callout"] .dai-callout-body > * + * {
  margin-top: 12px !important;
}

[data-component="Callout"] .dai-callout-body li + li {
  margin-top: 4px !important;
}

/*
 * API Reference: 엔드포인트 막대(메서드 + 경로) 오른쪽의 Try it 버튼을 숨긴다.
 * documentation.json에는 플레이그라운드를 끄는 설정이 없어서 CSS로 가린다.
 * 버튼에는 고유 클래스가 없으므로, 엔드포인트 막대의 클래스(rounded-xl, border-border-muted, shadow-xs)와 경로가 든 <pre>로 막대를 고른 뒤 그 안의 버튼을 숨긴다.
 */
.not-prose > div.rounded-xl.border-border-muted.shadow-xs:has(> div > pre) > button {
  display: none;
}
