/* 상세 페이지: 좌측 리드폼 + TOC */

body.post-template .site-content,
body.page-template .site-content {
  padding-top: 0;
  padding-bottom: 0;
}

.snipit-doc {
  --snipit-toc-width: 320px;
  --snipit-doc-max: 1232px;
  --snipit-post-width: calc(var(--snipit-doc-max) - var(--snipit-toc-width));
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    var(--snipit-toc-width)
    minmax(0, var(--snipit-post-width))
    minmax(0, 1fr);
  width: 100%;
  min-height: calc(100vh - var(--snipit-nav-stack-height, 96px));
  padding: 0 16px;
  box-sizing: border-box;
  background: #fff;
}

.snipit-doc__aside-bleed,
.snipit-doc__aside {
  background: #f4f7fe;
}

.snipit-doc__aside {
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.snipit-doc__aside-inner {
  --snipit-aside-inner-height: calc(100vh - var(--snipit-nav-stack-height, 96px) - 32px);
  position: sticky;
  top: calc(var(--snipit-nav-stack-height, 96px) + 16px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 20px;
  height: var(--snipit-aside-inner-height);
  max-height: var(--snipit-aside-inner-height);
  padding: 28px 18px 32px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.snipit-doc__main,
.snipit-doc__main-bleed {
  background: #fff;
}

.snipit-doc__main {
  width: 100%;
  min-width: 0;
  padding: 48px 0 72px;
  box-sizing: border-box;
}

.snipit-doc__main .gh-canvas {
  max-width: none;
}

/* Lead form */
.snipit-toc-lead {
  flex: 0 0 auto;
  padding: 0;
  margin-top: 0;
  background: transparent;
  border: none;
  box-sizing: border-box;
}

/* 긴 목차는 이 영역 안에서만 자동 스크롤(스크롤바 숨김). 사용자는 본문만 스크롤 */
.snipit-toc {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.snipit-toc::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.snipit-toc-lead__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snipit-toc-lead__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.snipit-toc-lead__form input[type="email"],
.snipit-toc-lead__form .snipit-toc-lead__input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #00000014;
  border-radius: 4px;
  background: #fff;
  color: #2b3761;
  font-family: var(--font-body, inherit);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  outline: none;
  box-sizing: border-box;
  appearance: none;
}

.snipit-toc-lead__form input[type="email"]::placeholder,
.snipit-toc-lead__form .snipit-toc-lead__input::placeholder {
  color: rgba(43, 55, 97, 0.72);
}

.snipit-toc-lead__form input[type="email"]:focus,
.snipit-toc-lead__form .snipit-toc-lead__input:focus {
  border-color: rgba(43, 55, 97, 0.35);
}

.snipit-toc-lead__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 4px;
  background: #2b3761;
  color: #fff;
  font-family: var(--font-heading, inherit);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  word-break: keep-all;
  cursor: pointer;
  transition: filter 160ms ease;
}

.snipit-toc-lead__button:hover {
  filter: brightness(1.08);
}

.snipit-toc-lead__form.loading .snipit-toc-lead__button,
.snipit-toc-lead__form .snipit-toc-lead__button:disabled {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

.snipit-toc-lead__success,
.snipit-toc-lead__error {
  display: none;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.snipit-toc-lead__form.success .snipit-toc-lead__success,
.snipit-toc-lead__form.error .snipit-toc-lead__error {
  display: block;
}

.snipit-toc-lead__success {
  color: #1b7a3d;
}

.snipit-toc-lead__error {
  color: #c0392b;
}

/* TOC */
.snipit-toc[hidden] {
  display: none;
}

.snipit-toc__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.snipit-toc__item {
  margin: 0;
}

.snipit-toc > .snipit-toc__list > .snipit-toc__item + .snipit-toc__item {
  margin-top: 8px;
}

.snipit-toc__list .snipit-toc__list {
  position: relative;
  gap: 1px;
  margin: 4px 0 1px;
  padding: 0 0 0 16px;
}

.snipit-toc__list .snipit-toc__list::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 5px;
  width: 1px;
  background: rgba(43, 55, 97, 0.14);
}

.snipit-toc__list .snipit-toc__list .snipit-toc__list {
  padding-left: 18px;
}

.snipit-toc__list .snipit-toc__list .snipit-toc__list::before {
  left: 6px;
}

.snipit-toc__link {
  position: relative;
  display: block;
  padding: 5px 8px 5px 12px;
  border-radius: 4px;
  color: rgba(43, 55, 97, 0.62);
  font-family: var(--font-body, inherit);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  text-decoration: none;
  word-break: keep-all;
  transition: color 140ms ease, background-color 140ms ease;
}

.snipit-toc__item--h1 > .snipit-toc__link,
.snipit-toc__item--h2 > .snipit-toc__link {
  padding-left: 0;
  color: #2b3761;
  font-family: var(--font-heading, inherit);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.snipit-toc__item--h3 > .snipit-toc__link,
.snipit-toc__item--h4 > .snipit-toc__link,
.snipit-toc__item--h5 > .snipit-toc__link,
.snipit-toc__item--h6 > .snipit-toc__link {
  padding-left: 12px;
}

.snipit-toc__item--h3 > .snipit-toc__link::before,
.snipit-toc__item--h4 > .snipit-toc__link::before,
.snipit-toc__item--h5 > .snipit-toc__link::before,
.snipit-toc__item--h6 > .snipit-toc__link::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(43, 55, 97, 0.28);
  transform: translateY(-50%);
}

.snipit-toc__item--h4 > .snipit-toc__link,
.snipit-toc__item--h5 > .snipit-toc__link,
.snipit-toc__item--h6 > .snipit-toc__link {
  font-size: 12px;
  color: rgba(43, 55, 97, 0.54);
}

.snipit-toc__link:hover {
  color: rgb(51, 79, 255);
  background: rgba(51, 79, 255, 0.05);
}

.snipit-toc__link.is-active {
  color: rgb(51, 79, 255);
  font-weight: 650;
  background: rgba(51, 79, 255, 0.08);
}

.snipit-toc__item--h3 > .snipit-toc__link.is-active::before,
.snipit-toc__item--h4 > .snipit-toc__link.is-active::before,
.snipit-toc__item--h5 > .snipit-toc__link.is-active::before,
.snipit-toc__item--h6 > .snipit-toc__link.is-active::before {
  background: rgb(51, 79, 255);
}

.snipit-toc-target {
  scroll-margin-top: calc(var(--snipit-nav-stack-height, 96px) + 20px);
}

@media (max-width: 959px) {
  .snipit-doc {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .snipit-doc__aside,
  .snipit-doc__aside-bleed,
  .snipit-doc__main-bleed {
    display: none;
  }

  .snipit-doc__main {
    padding: 32px 16px 56px;
  }
}
