/**
 * NM-D Theme — global rich content (CMS, descriptions, tables)
 * Author: Paweł Nosko / Design Cart
 */

/* ── Prose scope ───────────────────────────────────────────── */
.nmd-prose,
.rich-text,
.page-content--cms,
.page-content--general .rte,
.product-description,
#content.page-content--cms {
  font-family: var(--nmd-font-sans, 'DM Sans', sans-serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--nmd-dark, #1a1c2e);
}

.page-content--cms {
  padding: 40px 0 72px;
}

.nmd-cms-body {
  max-width: 820px;
  margin: 0 auto;
}

.nmd-cms-body--wide {
  max-width: 960px;
}

/* ── Headings ──────────────────────────────────────────────── */
.nmd-prose h1,
.nmd-prose h2,
.nmd-prose h3,
.nmd-prose h4,
.nmd-prose h5,
.nmd-prose h6,
.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6,
.page-content--cms h1,
.page-content--cms h2,
.page-content--cms h3,
.page-content--cms h4,
.page-content--cms h5,
.page-content--cms h6 {
  color: var(--nmd-dark, #1a1c2e);
  font-family: var(--nmd-font-sans, 'DM Sans', sans-serif);
  font-weight: 700;
  line-height: 1.25;
  margin: 2rem 0 0.85rem;
}

.nmd-prose h1:first-child,
.nmd-prose h2:first-child,
.nmd-prose h3:first-child,
.rich-text h1:first-child,
.rich-text h2:first-child,
.rich-text h3:first-child,
.page-content--cms h1:first-child,
.page-content--cms h2:first-child,
.page-content--cms h3:first-child {
  margin-top: 0;
}

.nmd-prose h1,
.rich-text h1,
.page-content--cms h1 {
  font-size: 1.875rem;
  font-weight: 800;
}

.nmd-prose h2,
.rich-text h2,
.page-content--cms h2 {
  font-size: 1.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px solid var(--nmd-hero-gray, #d5d7e4);
  position: relative;
}

.nmd-prose h2::after,
.rich-text h2::after,
.page-content--cms h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 56px;
  height: 2px;
  background: var(--nmd-cyan, #00c8e8);
}

.nmd-prose h3,
.rich-text h3,
.page-content--cms h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--nmd-purple, #5b3fc8);
}

.nmd-prose h4,
.rich-text h4,
.page-content--cms h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.nmd-prose h5,
.nmd-prose h6,
.rich-text h5,
.rich-text h6,
.page-content--cms h5,
.page-content--cms h6 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  color: var(--nmd-muted, #6b6d8a);
}

/* ── Paragraphs & text ─────────────────────────────────────── */
.nmd-prose p,
.rich-text p,
.page-content--cms p {
  margin: 0 0 1.15em;
  color: var(--nmd-dark, #1a1c2e);
}

.nmd-prose p:last-child,
.rich-text p:last-child,
.page-content--cms p:last-child {
  margin-bottom: 0;
}

.nmd-prose strong,
.nmd-prose b,
.rich-text strong,
.rich-text b,
.page-content--cms strong,
.page-content--cms b {
  font-weight: 700;
  color: var(--nmd-dark, #1a1c2e);
}

.nmd-prose em,
.nmd-prose i,
.rich-text em,
.rich-text i {
  font-style: italic;
}

.nmd-prose a,
.rich-text a,
.page-content--cms a {
  color: var(--nmd-purple, #5b3fc8);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s ease;
}

.nmd-prose a:hover,
.rich-text a:hover,
.page-content--cms a:hover {
  color: var(--nmd-cyan, #00c8e8);
}

/* ── Lists ─────────────────────────────────────────────────── */
.nmd-prose ul,
.nmd-prose ol,
.rich-text ul,
.rich-text ol,
.page-content--cms ul,
.page-content--cms ol {
  margin: 0 0 1.25em;
  padding-left: 1.35rem;
}

.nmd-prose ul,
.rich-text ul,
.page-content--cms ul {
  list-style: none;
}

.nmd-prose ul > li,
.rich-text ul > li,
.page-content--cms ul > li {
  position: relative;
  padding-left: 0.35rem;
  margin-bottom: 0.45em;
}

.nmd-prose ul > li::before,
.rich-text ul > li::before,
.page-content--cms ul > li::before {
  content: '';
  position: absolute;
  left: -1.05rem;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nmd-cyan, #00c8e8);
  box-shadow: 0 0 0 3px rgba(0, 200, 232, 0.18);
}

.nmd-prose ol,
.rich-text ol,
.page-content--cms ol {
  list-style: none;
  counter-reset: nmd-ol;
}

.nmd-prose ol > li,
.rich-text ol > li,
.page-content--cms ol > li {
  position: relative;
  padding-left: 0.25rem;
  margin-bottom: 0.5em;
  counter-increment: nmd-ol;
}

.nmd-prose ol > li::before,
.rich-text ol > li::before,
.page-content--cms ol > li::before {
  content: counter(nmd-ol);
  position: absolute;
  left: -1.55rem;
  top: 0.1em;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 6px;
  background: rgba(91, 63, 200, 0.1);
  color: var(--nmd-purple, #5b3fc8);
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.nmd-prose li > ul,
.nmd-prose li > ol,
.rich-text li > ul,
.rich-text li > ol {
  margin-top: 0.45em;
  margin-bottom: 0.35em;
}

/* ── Blockquote ────────────────────────────────────────────── */
.nmd-prose blockquote,
.rich-text blockquote,
.page-content--cms blockquote {
  margin: 1.75rem 0;
  padding: 1.15rem 1.35rem 1.15rem 1.25rem;
  background: #fff;
  border: 1px solid var(--nmd-hero-gray, #d5d7e4);
  border-left: 4px solid var(--nmd-cyan, #00c8e8);
  border-radius: 0 12px 12px 0;
  color: var(--nmd-muted, #6b6d8a);
  font-size: 1.05rem;
  line-height: 1.65;
  box-shadow: 0 8px 24px rgba(26, 28, 46, 0.04);
}

.nmd-prose blockquote p,
.rich-text blockquote p,
.page-content--cms blockquote p {
  margin: 0 0 0.65em;
  color: inherit;
}

.nmd-prose blockquote p:last-child,
.rich-text blockquote p:last-child,
.page-content--cms blockquote p:last-child {
  margin-bottom: 0;
}

.nmd-prose blockquote cite,
.rich-text blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  font-size: 0.8rem;
  color: var(--nmd-purple, #5b3fc8);
}

/* ── Horizontal rule ───────────────────────────────────────── */
.nmd-prose hr,
.rich-text hr,
.page-content--cms hr {
  border: 0;
  height: 1px;
  margin: 2.25rem 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--nmd-hero-gray, #d5d7e4) 12%,
    var(--nmd-hero-gray, #d5d7e4) 88%,
    transparent
  );
}

/* ── Images / figures ──────────────────────────────────────── */
.nmd-prose img,
.rich-text img,
.page-content--cms img {
  max-width: 100%;
  height: auto;
  border-radius: var(--nmd-radius, 12px);
  display: block;
  margin: 1.5rem 0;
}

.nmd-prose figure,
.rich-text figure {
  margin: 1.75rem 0;
}

.nmd-prose figcaption,
.rich-text figcaption {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--nmd-muted, #6b6d8a);
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
}

/* ── Inline code / pre ─────────────────────────────────────── */
.nmd-prose code,
.rich-text code,
.page-content--cms code {
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  font-size: 0.88em;
  background: rgba(91, 63, 200, 0.08);
  color: var(--nmd-purple, #5b3fc8);
  padding: 0.12em 0.4em;
  border-radius: 6px;
}

.nmd-prose pre,
.rich-text pre,
.page-content--cms pre {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: var(--nmd-dark, #1a1c2e);
  color: #e8eaf4;
  border-radius: var(--nmd-radius, 12px);
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  font-size: 0.875rem;
  line-height: 1.55;
}

.nmd-prose pre code,
.rich-text pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ── Tables (global in content areas) ──────────────────────── */
#wrapper .page-content table,
#wrapper .product-description table,
#wrapper .product-information table,
.nmd-prose table,
.rich-text table,
.page-content--cms table,
.nmd-cms-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.75rem 0;
  font-size: 0.95rem;
  line-height: 1.45;
  background: #fff;
  border: 1px solid var(--nmd-hero-gray, #d5d7e4);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(26, 28, 46, 0.04);
}

#wrapper .page-content thead th,
#wrapper .product-description thead th,
.nmd-prose thead th,
.rich-text thead th,
.page-content--cms thead th {
  background: var(--nmd-purple, #5b3fc8);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--nmd-font-mono, 'JetBrains Mono', monospace);
  text-align: left;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#wrapper .page-content th,
#wrapper .page-content td,
#wrapper .product-description th,
#wrapper .product-description td,
.nmd-prose th,
.nmd-prose td,
.rich-text th,
.rich-text td,
.page-content--cms th,
.page-content--cms td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--nmd-hero-gray, #d5d7e4);
  border-right: 1px solid var(--nmd-hero-gray, #d5d7e4);
  vertical-align: top;
  color: var(--nmd-dark, #1a1c2e);
}

#wrapper .page-content th:last-child,
#wrapper .page-content td:last-child,
.nmd-prose th:last-child,
.nmd-prose td:last-child,
.rich-text th:last-child,
.rich-text td:last-child,
.page-content--cms th:last-child,
.page-content--cms td:last-child {
  border-right: 0;
}

#wrapper .page-content tbody tr:last-child th,
#wrapper .page-content tbody tr:last-child td,
.nmd-prose tbody tr:last-child th,
.nmd-prose tbody tr:last-child td,
.rich-text tbody tr:last-child th,
.rich-text tbody tr:last-child td,
.page-content--cms tbody tr:last-child th,
.page-content--cms tbody tr:last-child td {
  border-bottom: 0;
}

#wrapper .page-content tbody tr:nth-child(even),
.nmd-prose tbody tr:nth-child(even),
.rich-text tbody tr:nth-child(even),
.page-content--cms tbody tr:nth-child(even) {
  background: rgba(240, 241, 248, 0.65);
}

#wrapper .page-content tbody tr:hover,
.nmd-prose tbody tr:hover,
.rich-text tbody tr:hover,
.page-content--cms tbody tr:hover {
  background: rgba(0, 200, 232, 0.08);
}

/* Scroll wrapper for wide tables */
.nmd-prose .table-responsive,
.rich-text .table-responsive,
.page-content--cms .table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
}

.nmd-prose .table-responsive table,
.rich-text .table-responsive table,
.page-content--cms .table-responsive table {
  margin: 0;
  min-width: 520px;
}

@media (max-width: 767px) {
  .nmd-prose,
  .rich-text,
  .page-content--cms {
    font-size: 1rem;
  }

  .nmd-prose h2,
  .rich-text h2,
  .page-content--cms h2 {
    font-size: 1.3rem;
  }

  .page-content--cms {
    padding: 28px 0 56px;
  }

  .nmd-cms-body,
  .nmd-prose {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #wrapper .page-content table,
  .nmd-prose table,
  .rich-text table,
  .page-content--cms table {
    min-width: 520px;
  }
}
