/* ==========================================================================
   SEO — текстовий блок (елемент nd_seo_text)
   Типографіка тіла — та сама, що в статті (css/nd-article.css, .nd-article__body).
   Довгий текст прокручується всередині блоку — JS не потрібен.
   ========================================================================== */

.nd-seo {
  --nd-seo-card: #faf4e8;
  --nd-seo-terra: #c57858;
  --nd-seo-terra-d: #8e5740;
  --nd-seo-ink: #2E2520;
  --nd-seo-muted: #7C6F62;
  --nd-seo-line: rgba(46, 37, 32, 0.12);

  padding: 54px 20px;
  color: var(--nd-seo-ink);
  -webkit-font-smoothing: antialiased;
}

.nd-seo *,
.nd-seo *::before,
.nd-seo *::after { box-sizing: border-box; }

/* --------------------------------------------------------------------------
   Контейнер — той самий, що в інших блоках (nd-cta, nd-posts, nd-branches)
   -------------------------------------------------------------------------- */
.nd-seo__wrap {
  max-width: 1140px;
  margin: 0 auto;
}

.nd-seo--center { text-align: center; }
.nd-seo--center .nd-seo__body { text-align: left; }

.nd-seo--card .nd-seo__wrap {
  padding: 36px 40px;
  border-radius: 20px;
  background: var(--nd-seo-card);
}

/* --------------------------------------------------------------------------
   Заголовок
   -------------------------------------------------------------------------- */
.nd-seo__title {
  margin: 0 0 18px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.25;
  font-weight: 700;
  color: var(--nd-seo-ink);
}

/* --------------------------------------------------------------------------
   Тіло — типографіка як у статті
   -------------------------------------------------------------------------- */
.nd-seo__body {
  position: relative;
  font-size: 17px;
  line-height: 1.75;
}
.nd-seo__body > *:first-child { margin-top: 0; }
.nd-seo__body > *:last-child { margin-bottom: 0; }

.nd-seo__body p {
  margin: 0 0 20px;
  font-size: inherit;
  line-height: inherit;
  color: var(--nd-seo-ink);
}

.nd-seo__body h2 {
  margin: 40px 0 14px;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
}
.nd-seo__body h3 {
  margin: 30px 0 12px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}
.nd-seo__body h4 {
  margin: 24px 0 10px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
}

.nd-seo__body ul,
.nd-seo__body ol {
  margin: 0 0 22px;
  padding-left: 22px;
}
.nd-seo__body li { margin-bottom: 8px; }
.nd-seo__body ul { list-style: none; padding-left: 4px; }
.nd-seo__body ul > li {
  position: relative;
  padding-left: 26px;
}
.nd-seo__body ul > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nd-seo-terra);
}
.nd-seo__body ol > li::marker {
  color: var(--nd-seo-terra-d);
  font-weight: 700;
}

.nd-seo__body a {
  color: var(--nd-seo-terra-d);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nd-seo__body a:hover { color: var(--nd-seo-terra); }

.nd-seo__body strong { font-weight: 700; }
.nd-seo__body em { font-style: italic; }

/* Список визначень — «перевага → пояснення». */
.nd-seo__body dl { margin: 0 0 22px; }
.nd-seo__body dt {
  margin: 14px 0 4px;
  font-weight: 700;
  color: var(--nd-seo-terra-d);
}
.nd-seo__body dt:first-child { margin-top: 0; }
.nd-seo__body dd {
  margin: 0;
  padding-left: 18px;
  border-left: 2px solid var(--nd-seo-line);
}

.nd-seo__body blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--nd-seo-terra);
  color: var(--nd-seo-muted);
  font-style: italic;
}

.nd-seo__body img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
}

.nd-seo__body table {
  width: 100%;
  margin: 0 0 22px;
  border-collapse: collapse;
  font-size: 15px;
}
.nd-seo__body th,
.nd-seo__body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--nd-seo-line);
  text-align: left;
  vertical-align: top;
}
.nd-seo__body th { font-weight: 700; }
.nd-seo__body thead th {
  border-bottom-color: var(--nd-seo-terra);
  color: var(--nd-seo-terra-d);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Обмеження висоти: текст прокручується всередині блоку (max-height +
   overflow), як на nextdoorcoders.com. Висоту задає інлайн --nd-seo-height
   з налаштувань елемента. Весь текст лишається в DOM.
   -------------------------------------------------------------------------- */
.nd-seo--scroll .nd-seo__body {
  max-height: var(--nd-seo-height, 300px);
  overflow-y: auto;
  padding-right: 18px; /* Відступ від скролбара, щоб текст не прилипав. */
  overscroll-behavior: contain;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--nd-seo-terra) rgba(46, 37, 32, 0.08);
}
.nd-seo--scroll .nd-seo__body:focus-visible {
  outline: 2px solid var(--nd-seo-terra);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Chrome / Edge / Safari */
.nd-seo--scroll .nd-seo__body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.nd-seo--scroll .nd-seo__body::-webkit-scrollbar-track {
  background: rgba(46, 37, 32, 0.08);
  border-radius: 10px;
}
.nd-seo--scroll .nd-seo__body::-webkit-scrollbar-thumb {
  background-color: var(--nd-seo-terra);
  border-radius: 10px;
}
.nd-seo--scroll .nd-seo__body::-webkit-scrollbar-thumb:hover {
  background-color: var(--nd-seo-terra-d);
}

@media (max-width: 767px) {
  .nd-seo { padding: 40px 16px; }
  .nd-seo--card .nd-seo__wrap {
    padding: 24px 18px;
    border-radius: 16px;
  }
  .nd-seo--scroll .nd-seo__body { padding-right: 12px; }
  .nd-seo__body { font-size: 16px; }
  .nd-seo__body h2 { font-size: 24px; margin-top: 30px; }
  .nd-seo__body h3 { font-size: 20px; margin-top: 24px; }
}
