/**
 * CKEditor / CMS article content styles
 * Apply class "ck-content" (or "article-content") on the wrapper that renders
 * HTML from CKEditor. Styles are scoped so they do not fight site UI.
 */

.ck-content,
.article-content {
  color: #334155;
  font-size: 1.0625rem;
  line-height: 1.75;
  max-width: 48rem;
}

/* ----- Headings ----- */
.ck-content h1,
.ck-content h2,
.ck-content h3,
.ck-content h4,
.ck-content h5,
.ck-content h6,
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: #1b4332;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 1.75em;
  margin-bottom: 0.6em;
}

.ck-content h1:first-child,
.ck-content h2:first-child,
.ck-content h3:first-child,
.article-content h1:first-child,
.article-content h2:first-child,
.article-content h3:first-child {
  margin-top: 0;
}

.ck-content h1,
.article-content h1 {
  font-size: 1.875rem;
}

.ck-content h2,
.article-content h2 {
  font-size: 1.5rem;
}

.ck-content h3,
.article-content h3 {
  font-size: 1.25rem;
}

.ck-content h4,
.article-content h4 {
  font-size: 1.125rem;
}

.ck-content h5,
.ck-content h6,
.article-content h5,
.article-content h6 {
  font-size: 1rem;
  font-weight: 700;
}

/* ----- Paragraphs ----- */
.ck-content p,
.article-content p {
  margin: 0 0 1.15em;
}

.ck-content p:last-child,
.article-content p:last-child {
  margin-bottom: 0;
}

/* Lead / first paragraph emphasis (optional if CMS uses <p class="lead">) */
.ck-content p.lead,
.article-content p.lead {
  font-size: 1.2rem;
  color: #475569;
}

/* ----- Links ----- */
.ck-content a,
.article-content a {
  color: #e85d04;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ck-content a:hover,
.article-content a:hover {
  color: #dc2f02;
}

/* ----- Lists ----- */
.ck-content ul,
.ck-content ol,
.article-content ul,
.article-content ol {
  margin: 0 0 1.25em;
  padding-left: 1.35em;
}

.ck-content ul,
.article-content ul {
  list-style-type: disc;
}

.ck-content ol,
.article-content ol {
  list-style-type: decimal;
}

.ck-content li,
.article-content li {
  margin-bottom: 0.45em;
  padding-left: 0.25em;
}

.ck-content li > ul,
.ck-content li > ol,
.article-content li > ul,
.article-content li > ol {
  margin-top: 0.45em;
  margin-bottom: 0.45em;
}

/* CKEditor todo list / checklist if enabled */
.ck-content .todo-list,
.article-content .todo-list {
  list-style: none;
  padding-left: 0;
}

.ck-content .todo-list li,
.article-content .todo-list li {
  margin-bottom: 0.5em;
}

/* ----- Blockquote ----- */
.ck-content blockquote,
.article-content blockquote {
  margin: 1.5em 0;
  padding: 0.85em 1.25em;
  border-left: 4px solid #e85d04;
  background: #f5f5f4;
  color: #475569;
  font-style: italic;
  border-radius: 0 0.75rem 0.75rem 0;
}

.ck-content blockquote p:last-child,
.article-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ----- Images (CKEditor figure / img) ----- */
.ck-content img,
.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 1.5em auto;
}

.ck-content figure,
.article-content figure {
  margin: 1.75em 0;
}

.ck-content figure img,
.article-content figure img {
  margin: 0 auto;
}

.ck-content figcaption,
.article-content figcaption {
  margin-top: 0.5em;
  font-size: 0.875rem;
  color: #64748b;
  text-align: center;
}

/* Image alignment helpers from CKEditor */
.ck-content .image-style-align-left,
.ck-content .image_resized.image-style-align-left,
.article-content .image-style-align-left {
  float: left;
  margin: 0.35em 1.25em 1em 0;
  max-width: 50%;
}

.ck-content .image-style-align-right,
.ck-content .image_resized.image-style-align-right,
.article-content .image-style-align-right {
  float: right;
  margin: 0.35em 0 1em 1.25em;
  max-width: 50%;
}

.ck-content .image-style-block-align-left,
.article-content .image-style-block-align-left {
  margin-left: 0;
  margin-right: auto;
}

.ck-content .image-style-block-align-right,
.article-content .image-style-block-align-right {
  margin-left: auto;
  margin-right: 0;
}

.ck-content .image-style-align-center,
.article-content .image-style-align-center {
  margin-left: auto;
  margin-right: auto;
}

/* Clear floats after floated images */
.ck-content::after,
.article-content::after {
  content: "";
  display: table;
  clear: both;
}

/* ----- Tables ----- */
.ck-content table,
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
  overflow-x: auto;
  display: block;
}

.ck-content table td,
.ck-content table th,
.article-content table td,
.article-content table th {
  border: 1px solid #e7e5e4;
  padding: 0.65em 0.85em;
  text-align: left;
  vertical-align: top;
}

.ck-content table th,
.article-content table th {
  background: #f5f5f4;
  color: #1b4332;
  font-weight: 700;
}

.ck-content table tr:nth-child(even) td,
.article-content table tr:nth-child(even) td {
  background: #fafaf9;
}

/* ----- Horizontal rule ----- */
.ck-content hr,
.article-content hr {
  border: 0;
  border-top: 1px solid #e7e5e4;
  margin: 2em 0;
}

/* ----- Code / pre ----- */
.ck-content code,
.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: #f5f5f4;
  color: #1b4332;
  padding: 0.15em 0.4em;
  border-radius: 0.35rem;
}

.ck-content pre,
.article-content pre {
  margin: 1.5em 0;
  padding: 1em 1.15em;
  background: #0d1b12;
  color: #d8f3dc;
  border-radius: 0.75rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}

.ck-content pre code,
.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ----- Media embed (video/iframe from CKEditor) ----- */
.ck-content .media,
.article-content .media,
.ck-content iframe,
.article-content iframe {
  display: block;
  max-width: 100%;
  margin: 1.5em 0;
  border-radius: 0.75rem;
}

.ck-content .media iframe,
.article-content .media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

/* ----- Strong / em / mark ----- */
.ck-content strong,
.ck-content b,
.article-content strong,
.article-content b {
  color: #1b4332;
  font-weight: 700;
}

.ck-content em,
.ck-content i,
.article-content em,
.article-content i {
  font-style: italic;
}

.ck-content mark,
.article-content mark {
  background: #fef3c7;
  color: inherit;
  padding: 0.05em 0.25em;
  border-radius: 0.2rem;
}

/* ----- Definition list ----- */
.ck-content dl,
.article-content dl {
  margin: 0 0 1.25em;
}

.ck-content dt,
.article-content dt {
  font-weight: 700;
  color: #1b4332;
  margin-top: 0.75em;
}

.ck-content dd,
.article-content dd {
  margin-left: 1em;
  color: #475569;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .ck-content,
  .article-content {
    font-size: 1rem;
  }

  .ck-content h1,
  .article-content h1 {
    font-size: 1.5rem;
  }

  .ck-content h2,
  .article-content h2 {
    font-size: 1.3rem;
  }

  .ck-content .image-style-align-left,
  .ck-content .image-style-align-right,
  .article-content .image-style-align-left,
  .article-content .image-style-align-right {
    float: none;
    max-width: 100%;
    margin: 1.25em 0;
  }
}
