/* ===== Nexfon: free-form text section =====
   Typography for a nexfon/rich-text block. The content is whatever the editor put
   there — core headings, paragraphs, lists, quotes — so every rule targets plain
   elements inside the body rather than classes of our own.

   Self-contained on purpose: pages that render this block do not always load the
   block library's or the theme's global styles, so alignment, palette colours and
   font-size presets the editor toolbar can apply are all defined here as well. */
.nexfon-richtext {
  --richtext-accent: var(--primary, #6c4099);
  --richtext-heading: var(--campaign-text, #101828);
  --richtext-body: rgba(26, 18, 46, 0.76);

  position: relative;
  padding: 64px 0 88px;
  color: var(--richtext-body);
  direction: rtl;
  text-align: right;
}

.nexfon-richtext[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.nexfon-richtext.is-soft { background: linear-gradient(180deg, #fbf9ff 0%, #ffffff 100%); }
.nexfon-richtext.is-white { background: #ffffff; }
.nexfon-richtext.is-tint { background: #f6f4fb; }
.nexfon-richtext.is-plain { background: transparent; }

/* A comfortable measure for reading; "wide" matches the page's other sections. */
.nexfon-richtext-body {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: 1rem;
  line-height: 2.1;
}

.nexfon-richtext.is-wide .nexfon-richtext-body {
  max-width: 1180px;
}

.nexfon-richtext-body > :first-child { margin-top: 0; }
.nexfon-richtext-body > :last-child { margin-bottom: 0; }

/* --- headings --- */
.nexfon-richtext-body h1,
.nexfon-richtext-body h2,
.nexfon-richtext-body h3,
.nexfon-richtext-body h4,
.nexfon-richtext-body h5,
.nexfon-richtext-body h6 {
  color: var(--richtext-heading);
  font-weight: 900;
  letter-spacing: 0;
}

.nexfon-richtext-body h1,
.nexfon-richtext-body h2 {
  margin: 56px 0 18px;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  line-height: 1.5;
}

.nexfon-richtext-body h3 {
  margin: 40px 0 12px;
  font-size: 1.24rem;
  line-height: 1.7;
}

/* The rule sits on the inline-start edge, so it follows the text direction. */
.nexfon-richtext-body h3::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 3px;
  margin-inline-end: 12px;
  vertical-align: middle;
  border-radius: 99px;
  background: var(--richtext-accent);
}

/* A centred sub-heading has no start edge for the rule to sit on. */
.nexfon-richtext-body h3.has-text-align-center::before {
  display: none;
}

.nexfon-richtext-body h4,
.nexfon-richtext-body h5,
.nexfon-richtext-body h6 {
  margin: 30px 0 10px;
  font-size: 1.06rem;
  line-height: 1.8;
}

/* --- text --- */
.nexfon-richtext-body p {
  margin: 0 0 18px;
}

.nexfon-richtext-body strong,
.nexfon-richtext-body b {
  font-weight: 800;
  color: var(--richtext-heading);
}

.nexfon-richtext-body a {
  color: var(--richtext-accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  text-decoration-color: rgba(108, 64, 153, 0.35);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.nexfon-richtext-body a:hover,
.nexfon-richtext-body a:focus-visible {
  color: var(--primary-dark, #543277);
  text-decoration-color: currentColor;
}

.nexfon-richtext-body mark {
  padding: 0 4px;
  border-radius: 4px;
}

.nexfon-richtext-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(108, 64, 153, 0.08);
  font-size: 0.92em;
  direction: ltr;
  unicode-bidi: isolate;
}

/* --- lists --- */
.nexfon-richtext-body ul,
.nexfon-richtext-body ol {
  margin: 0 0 18px;
  padding-inline-start: 26px;
}

.nexfon-richtext-body ul { list-style: disc; }
.nexfon-richtext-body ol { list-style: decimal; }

.nexfon-richtext-body li {
  margin-bottom: 6px;
}

.nexfon-richtext-body li::marker {
  color: var(--richtext-accent);
  font-weight: 800;
}

.nexfon-richtext-body li > ul,
.nexfon-richtext-body li > ol {
  margin: 6px 0 0;
}

/* --- quote and divider --- */
.nexfon-richtext-body blockquote {
  margin: 26px 0;
  padding: 18px 22px;
  border-inline-start: 4px solid var(--richtext-accent);
  border-radius: 12px;
  background: rgba(108, 64, 153, 0.06);
  color: var(--richtext-heading);
}

.nexfon-richtext-body blockquote p:last-of-type { margin-bottom: 0; }

.nexfon-richtext-body blockquote cite {
  display: block;
  margin-top: 8px;
  font-size: 0.88rem;
  font-style: normal;
  opacity: 0.7;
}

.nexfon-richtext-body hr {
  margin: 36px auto;
  width: 96px;
  height: 3px;
  border: 0;
  border-radius: 99px;
  background: rgba(108, 64, 153, 0.22);
}

/* --- what the editor toolbar can apply --- */
.nexfon-richtext-body .has-text-align-center { text-align: center; }
.nexfon-richtext-body .has-text-align-left { text-align: left; }
.nexfon-richtext-body .has-text-align-right { text-align: right; }

.nexfon-richtext-body .has-primary-color { color: #6c4099; }
.nexfon-richtext-body .has-accent-color { color: #2bb673; }
.nexfon-richtext-body .has-text-color.has-text-color { color: #101828; }
.nexfon-richtext-body .has-muted-color { color: #667085; }
.nexfon-richtext-body .has-surface-color { color: #f9fafb; }

.nexfon-richtext-body .has-primary-background-color { background-color: #6c4099; }
.nexfon-richtext-body .has-accent-background-color { background-color: #2bb673; }
.nexfon-richtext-body .has-text-background-color { background-color: #101828; }
.nexfon-richtext-body .has-muted-background-color { background-color: #667085; }
.nexfon-richtext-body .has-surface-background-color { background-color: #f9fafb; }

/* A block given a background needs room around its text. */
.nexfon-richtext-body p.has-background,
.nexfon-richtext-body h1.has-background,
.nexfon-richtext-body h2.has-background,
.nexfon-richtext-body h3.has-background,
.nexfon-richtext-body h4.has-background {
  padding: 14px 20px;
  border-radius: 12px;
}

.nexfon-richtext-body .has-small-font-size { font-size: 0.875rem; }
.nexfon-richtext-body .has-medium-font-size { font-size: 1.125rem; }
.nexfon-richtext-body .has-large-font-size { font-size: 1.5rem; line-height: 1.8; }
.nexfon-richtext-body .has-x-large-font-size { font-size: 2rem; line-height: 1.6; }

@media (max-width: 860px) {
  .nexfon-richtext {
    padding: 48px 0 64px;
  }

  .nexfon-richtext-body {
    line-height: 2;
  }

  .nexfon-richtext-body h1,
  .nexfon-richtext-body h2 {
    margin-top: 44px;
  }

  .nexfon-richtext-body h3 {
    margin-top: 32px;
    font-size: 1.14rem;
  }
}

/* ===== "Read more" =====
   Nothing here clips the text on its own: .is-ready and .is-collapsed are added by
   rich-text.js, and only when the text is taller than the clip. Without the script
   the section is simply fully open. */
.nexfon-richtext.is-ready .nexfon-richtext-body {
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The last lines fade out instead of being cut mid-letter. A mask is used rather than
   a gradient overlay so it works on every background variant, and the fade is a fixed
   depth so it stays the same few lines while the box is sliding shut. */
.nexfon-richtext.is-collapsed .nexfon-richtext-body {
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 120px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 120px), transparent 100%);
}

.nexfon-richtext-more {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding: 0 24px;
}

.nexfon-richtext-more[hidden] {
  display: none;
}

.nexfon-richtext.is-collapsed .nexfon-richtext-more {
  margin-top: 6px;
}

.nexfon-richtext-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border: 1.5px solid rgba(108, 64, 153, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--richtext-accent);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 800;
  line-height: 1.6;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(108, 64, 153, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nexfon-richtext-toggle:hover {
  border-color: var(--richtext-accent);
  background: var(--richtext-accent);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(108, 64, 153, 0.2);
}

.nexfon-richtext-toggle:focus-visible {
  outline: 3px solid rgba(108, 64, 153, 0.35);
  outline-offset: 3px;
}

.nexfon-richtext-toggle-icon {
  flex: 0 0 auto;
  transition: transform 0.3s ease;
}

.nexfon-richtext-toggle[aria-expanded="true"] .nexfon-richtext-toggle-icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .nexfon-richtext.is-ready .nexfon-richtext-body,
  .nexfon-richtext-toggle,
  .nexfon-richtext-toggle-icon {
    transition: none;
  }
}
