:where(.rich-content, .ck-content) {
  --rich-primary: var(--site-primary, #40ff8c);
  --rich-accent: var(--site-accent, #1de9b6);
  --rich-background: var(--site-background, #05070a);
  color: rgba(255, 255, 255, 0.74);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  line-height: 1.78;
}

.ck-editor__editable.ck-content {
  min-height: 24rem;
  padding: 1.5rem 1.75rem;
  border-color: rgba(64, 255, 140, 0.28) !important;
  background: #0a0e15;
}

.ck-editor__editable.ck-content.ck-focused {
  border-color: var(--rich-primary) !important;
  box-shadow: 0 0 0 1px var(--rich-primary) !important;
}

:where(.rich-content, .ck-content) > :first-child { margin-top: 0; }
:where(.rich-content, .ck-content) > :last-child { margin-bottom: 0; }

:where(.rich-content, .ck-content) p {
  margin: 0 0 1.15rem;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.78;
}

:where(.rich-content, .ck-content) h2,
:where(.rich-content, .ck-content) h3,
:where(.rich-content, .ck-content) h4 {
  color: #fff;
  font-weight: 650;
  letter-spacing: -0.015em;
}

:where(.rich-content, .ck-content) h2 {
  margin: 2.75rem 0 1rem;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.22;
}

:where(.rich-content, .ck-content) h3 {
  margin: 2.25rem 0 0.9rem;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.3;
}

:where(.rich-content, .ck-content) h4 {
  margin: 1.75rem 0 0.75rem;
  color: var(--rich-primary);
  font-size: clamp(1.08rem, 1.6vw, 1.25rem);
  line-height: 1.35;
}

:where(.rich-content, .ck-content) strong { color: #fff; font-weight: 700; }
:where(.rich-content, .ck-content) em { color: rgba(255, 255, 255, 0.88); }
:where(.rich-content, .ck-content) u { text-decoration-color: var(--rich-accent); text-underline-offset: 0.18em; }
:where(.rich-content, .ck-content) s { color: rgba(255, 255, 255, 0.52); }

:where(.rich-content, .ck-content) a {
  color: var(--rich-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--rich-accent) 55%, transparent);
  text-underline-offset: 0.2em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

:where(.rich-content, .ck-content) a:hover {
  color: var(--rich-primary);
  text-decoration-color: currentColor;
}

:where(.rich-content, .ck-content) ul,
:where(.rich-content, .ck-content) ol {
  margin: 0 0 1.5rem;
  padding-left: 1.55rem;
  color: rgba(255, 255, 255, 0.74);
}

:where(.rich-content, .ck-content) ul { list-style: disc; }
:where(.rich-content, .ck-content) ol { list-style: decimal; }
:where(.rich-content, .ck-content) li { margin: 0.55rem 0; padding-left: 0.25rem; line-height: 1.68; }
:where(.rich-content, .ck-content) li::marker { color: var(--rich-primary); font-weight: 700; }

:where(.rich-content, .ck-content) blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 1.25rem 1.4rem 1.25rem 1.65rem;
  border: 1px solid color-mix(in srgb, var(--rich-accent) 28%, transparent);
  border-left: 4px solid var(--rich-accent);
  border-radius: 0 0.8rem 0.8rem 0;
  background: color-mix(in srgb, var(--rich-accent) 7%, #0a0e15);
  color: rgba(255, 255, 255, 0.86);
  font-style: normal;
}

:where(.rich-content, .ck-content) blockquote p:last-child { margin-bottom: 0; }

:where(.rich-content, .ck-content) figure.image {
  width: 100%;
  max-width: 100%;
  margin: 2rem auto;
  text-align: center;
}

:where(.rich-content, .ck-content) figure.image[style*="width:75"] { width: 75%; }
:where(.rich-content, .ck-content) figure.image[style*="width:50"] { width: 50%; }

:where(.rich-content, .ck-content) figure.image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--rich-primary) 22%, transparent);
  border-radius: 0.85rem;
  background: #070a0f;
}

:where(.rich-content, .ck-content) figure.image figcaption {
  margin-top: 0.7rem;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.84rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 640px) {
  :where(.rich-content, .ck-content) { font-size: 1rem; line-height: 1.72; }
  :where(.rich-content, .ck-content) figure.image,
  :where(.rich-content, .ck-content) figure.image[style*="width:75"],
  :where(.rich-content, .ck-content) figure.image[style*="width:50"] { width: 100%; }
  :where(.rich-content, .ck-content) blockquote { margin: 1.5rem 0; padding: 1rem 1rem 1rem 1.2rem; }
}

/* The admin editor uses a light canvas; public rich content remains light on dark. */
.ck-editor__editable.ck-content,
.ck-editor__editable.ck-content p,
.ck-editor__editable.ck-content li,
.ck-editor__editable.ck-content h2,
.ck-editor__editable.ck-content h3,
.ck-editor__editable.ck-content h4,
.ck-editor__editable.ck-content strong,
.ck-editor__editable.ck-content em,
.ck-editor__editable.ck-content s {
  color: #15171a;
}

.ck-editor__editable.ck-content {
  background: #fff;
}

.ck-editor__editable.ck-content a {
  color: #087a43;
}

.ck-editor__editable.ck-content h4 {
  color: #087a43;
}

.ck-editor__editable.ck-content ul,
.ck-editor__editable.ck-content ol {
  color: #15171a;
}

.ck-editor__editable.ck-content li::marker {
  color: #087a43;
}

.ck-editor__editable.ck-content blockquote {
  border-color: #b9dfcc;
  border-left-color: #15945a;
  background: #f1faf5;
  color: #202522;
}

.ck-editor__editable.ck-content blockquote p,
.ck-editor__editable.ck-content blockquote strong,
.ck-editor__editable.ck-content blockquote em,
.ck-editor__editable.ck-content blockquote s {
  color: inherit;
}

.ck-editor__editable.ck-content figure.image img {
  border-color: #cad8d0;
  background: #f5f7f6;
}

.ck-editor__editable.ck-content figure.image figcaption {
  color: #5d6862;
}
