body.single-post::before,
body.single-post::after,
body.investi-legal-page::before,
body.investi-legal-page::after {
  opacity: 0.22;
}

body.single-post,
body.investi-legal-page {
  background: var(--bg-color);
}

:root {
  --investi-single-post-media-frame: 1120px;
  --investi-single-post-side-gutter: 16px;
}

.investi-single-post {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
  font-family: var(--investi-font-family) !important;
}

.investi-single-post *,
.investi-single-post button,
.investi-single-post input,
.investi-single-post select,
.investi-single-post textarea {
  font-family: var(--investi-font-family) !important;
}

.investi-single-post__article {
  background:
    radial-gradient(circle at top right, rgba(203, 107, 253, 0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(46, 126, 206, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(12, 14, 24, 0.72), rgba(18, 23, 38, 0.58));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow: visible;
}

.investi-single-post__header {
  /* Anchors the language pair to this column's top right corner. */
  position: relative;
  padding: 12px 0 24px;
  width: min(var(--investi-single-post-media-frame), calc(100% - (var(--investi-single-post-side-gutter) * 2)));
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.investi-single-post__header > * {
  margin-left: auto;
  margin-right: auto;
}

/* Language switch on the legal pages.
   Built on the miniheader mode toggle's geometry — track, sliding thumb,
   translateX on state — so it reads as the same kind of control, just wide
   enough for words instead of icons.
   Pinned to the top right of the header rather than sitting in its flow:
   .investi-single-post__header centres its children with auto margins, which
   put it above the title and made it look like part of the document. */
.investi-single-post__lang-switch {
  position: absolute;
  top: 12px;
  right: 0;
  z-index: 1;
  display: block;
  margin: 0;
  text-decoration: none;
  border-radius: 999px;
}

.investi-single-post__lang-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 80px);
  align-items: center;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2e7ece 0%, #5d98d1 55%, #87b9e5 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 6px 16px rgba(46, 126, 206, 0.2);
}

.investi-single-post__lang-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 80px;
  height: 26px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: transform 0.24s ease;
}

/* Fixed label order, so the thumb's position is what carries the meaning. */
.investi-single-post__lang-switch[data-showing="mt"] .investi-single-post__lang-thumb {
  transform: translateX(80px);
}

.investi-single-post__lang-option {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.24s ease;
}

/* The one under the thumb sits on white, so it has to invert.
   Targeted by explicit class, not position: the first span in the track is the
   thumb, so :first-of-type never matched the English label and it rendered
   white on white. */
.investi-single-post__lang-switch[data-showing="en"] .investi-single-post__lang-option--en,
.investi-single-post__lang-switch[data-showing="mt"] .investi-single-post__lang-option--mt {
  color: #1f2937;
}

.investi-single-post__lang-switch:hover .investi-single-post__lang-track {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 20px rgba(46, 126, 206, 0.32);
}

.investi-single-post__lang-switch:focus-visible {
  outline: 2px solid #87b9e5;
  outline-offset: 3px;
}

/* Clears room above the title so a long one cannot run under the switch.
   Progressive — without :has() the header is simply tighter, nothing breaks. */
.investi-single-post__header:has(.investi-single-post__lang-switch) {
  padding-top: 58px;
}

/* Too narrow to pin it clear, so it returns to the flow, right-aligned. */
@media (max-width: 640px) {
  .investi-single-post__lang-switch {
    position: static;
    width: fit-content;
    margin: 0 0 1em auto;
  }

  .investi-single-post__header:has(.investi-single-post__lang-switch) {
    padding-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .investi-single-post__lang-thumb {
    transition-duration: 1ms;
  }
}

.investi-single-post__title {
  margin: 0;
  max-width: none;
  font-family: inherit !important;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-wrap: balance;
  color: #fff !important;
}

.investi-single-post__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
}

.investi-single-post__meta-item {
  color: inherit;
}

.investi-single-post__meta-separator {
  opacity: 0.45;
}

.investi-single-post__featured-image {
  width: min(var(--investi-single-post-media-frame), calc(100% - (var(--investi-single-post-side-gutter) * 2)));
  margin: 0 auto;
  padding: 0;
  background: transparent;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.investi-single-post__featured-image-tag {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.investi-single-post__layout {
  display: grid;
  grid-template-columns: minmax(0, 820px) minmax(220px, 260px);
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
  justify-content: center;
  gap: 22px;
  padding: 38px clamp(16px, 3vw, 40px) clamp(40px, 5vw, 72px);
  background: transparent;
}

.investi-single-post__layout.is-toc-empty {
  grid-template-columns: minmax(0, 820px);
  max-width: 820px;
}

.investi-single-post__toc {
  align-self: start;
  position: sticky;
  top: var(--investi-single-post-sticky-offset, 24px);
  width: 100%;
  min-width: 0;
}

.investi-single-post__toc-card {
  position: static;
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.investi-single-post__toc.is-empty {
  display: none;
}

.investi-single-post__toc-title {
  margin: 0 0 16px;
  font-family: inherit !important;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.56);
}

.investi-single-post__toc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.investi-single-post__toc-list .investi-single-post__toc-list {
  margin-top: 6px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.investi-single-post__toc-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.investi-single-post__toc-link:hover,
.investi-single-post__toc-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  outline: none;
}

.investi-single-post__toc-link.is-active {
  color: #fff;
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.investi-single-post__toc-link--level-1 {
  font-weight: 700;
}

.investi-single-post__toc-link--level-2,
.investi-single-post__toc-link--level-3,
.investi-single-post__toc-link--level-4,
.investi-single-post__toc-link--level-5,
.investi-single-post__toc-link--level-6 {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.62);
}

.investi-single-post__toc-link--level-3,
.investi-single-post__toc-link--level-4,
.investi-single-post__toc-link--level-5,
.investi-single-post__toc-link--level-6 {
  padding-top: 8px;
  padding-bottom: 8px;
}

.investi-single-post__content-column {
  min-width: 0;
  width: 100%;
}

.investi-single-post__layout.is-toc-empty .investi-single-post__content-column {
  max-width: 820px;
  margin: 0 auto;
}

.investi-single-post__content {
  color: #eef2ff;
  font-size: clamp(1.04rem, 1vw + 0.72rem, 1.16rem);
  line-height: 1.82;
  background:
    linear-gradient(180deg, rgba(13, 15, 25, 0.7), rgba(19, 22, 35, 0.58));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: clamp(24px, 3vw, 38px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.investi-single-post__content > *:first-child {
  margin-top: 0;
}

.investi-single-post__content h1,
.investi-single-post__content h2,
.investi-single-post__content h3,
.investi-single-post__content h4,
.investi-single-post__content h5,
.investi-single-post__content h6 {
  scroll-margin-top: calc(var(--investi-single-post-sticky-offset, 24px) + 18px);
  margin: 2.2em 0 0.72em;
  font-family: inherit !important;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #fff !important;
}

.investi-single-post__content h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.investi-single-post__content h2 {
  font-size: clamp(1.7rem, 2.4vw, 2.35rem);
}

.investi-single-post__content h3 {
  font-size: clamp(1.34rem, 2vw, 1.78rem);
}

.investi-single-post__content h4 {
  font-size: clamp(1.14rem, 1.6vw, 1.4rem);
}

.investi-single-post__content h5 {
  font-size: clamp(1.02rem, 1.3vw, 1.2rem);
}

.investi-single-post__content h6 {
  font-size: 1rem;
  letter-spacing: 0;
}

.investi-single-post__content p,
.investi-single-post__content ul,
.investi-single-post__content ol,
.investi-single-post__content blockquote,
.investi-single-post__content figure {
  margin: 0 0 1.2em;
}

.investi-single-post__content p {
  max-width: 72ch;
}

.investi-single-post__content > p:first-child,
.investi-single-post__content > .wp-block-paragraph:first-child,
.investi-single-post__content > .wp-block-group:first-child p:first-child {
  max-width: none;
  margin-bottom: 1.35em;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: clamp(1.15rem, 1.3vw + 0.88rem, 1.45rem);
  line-height: 1.65;
  font-weight: 500;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.investi-single-post__content > .wp-block-group:first-child,
.investi-single-post__content > .wp-block-columns:first-child,
.investi-single-post__content > .wp-block-column:first-child,
.investi-single-post__content > blockquote:first-child,
.investi-single-post__content > .wp-block-pullquote:first-child {
  max-width: none !important;
  width: 100% !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.investi-single-post__content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.investi-single-post__content figure.wp-block-image,
.investi-single-post__content .wp-block-image,
.investi-single-post__content .wp-caption {
  display: block;
  width: 100%;
  max-width: 100%;
}

.investi-single-post__content figure.wp-block-image img,
.investi-single-post__content .wp-block-image img,
.investi-single-post__content .wp-caption img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.investi-single-post__content a {
  color: var(--text-color);
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.investi-single-post__content blockquote {
  margin-left: 0;
  padding: 20px 22px;
  border-left: 4px solid var(--accent-color);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 255, 255, 0.05);
}

.investi-single-post__content ul,
.investi-single-post__content ol {
  padding-left: 1.4em;
}

.investi-single-post__content li + li {
  margin-top: 0.45em;
}

.investi-single-post__content strong {
  color: #fff;
}

html:not([data-mode="dark"]) .investi-single-post__article {
  background:
    radial-gradient(circle at top right, rgba(203, 107, 253, 0.12), transparent 32%),
    radial-gradient(circle at bottom left, rgba(46, 126, 206, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(244, 247, 252, 0.5));
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 18px 40px rgba(20, 24, 40, 0.12);
}

html:not([data-mode="dark"]) .investi-single-post__header {
  border-bottom-color: rgba(20, 24, 40, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

html:not([data-mode="dark"]) .investi-single-post__title,
html:not([data-mode="dark"]) .investi-single-post__content h1,
html:not([data-mode="dark"]) .investi-single-post__content h2,
html:not([data-mode="dark"]) .investi-single-post__content h3,
html:not([data-mode="dark"]) .investi-single-post__content h4,
html:not([data-mode="dark"]) .investi-single-post__content h5,
html:not([data-mode="dark"]) .investi-single-post__content h6,
html:not([data-mode="dark"]) .investi-single-post__content strong {
  color: var(--heading-color) !important;
}

html:not([data-mode="dark"]) .investi-single-post__meta {
  color: var(--text-secondary);
}

html:not([data-mode="dark"]) .investi-single-post__toc-card {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.45);
}

html:not([data-mode="dark"]) .investi-single-post__toc-title {
  color: var(--text-secondary);
}

html:not([data-mode="dark"]) .investi-single-post__toc-link {
  color: var(--text-secondary);
}

html:not([data-mode="dark"]) .investi-single-post__toc-list .investi-single-post__toc-list {
  border-left-color: rgba(20, 24, 40, 0.08);
}

html:not([data-mode="dark"]) .investi-single-post__toc-link:hover,
html:not([data-mode="dark"]) .investi-single-post__toc-link:focus-visible {
  color: var(--text-color);
  background: rgba(20, 24, 40, 0.05);
  border-color: rgba(20, 24, 40, 0.08);
}

html:not([data-mode="dark"]) .investi-single-post__content {
  color: var(--text-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(246, 248, 252, 0.74));
  border-color: rgba(255, 255, 255, 0.45);
}

html:not([data-mode="dark"]) .investi-single-post__content > p:first-child,
html:not([data-mode="dark"]) .investi-single-post__content > .wp-block-paragraph:first-child,
html:not([data-mode="dark"]) .investi-single-post__content > .wp-block-group:first-child p:first-child {
  color: var(--text-color) !important;
}

@media (max-width: 900px) {
  .investi-single-post__layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .investi-single-post__toc {
    position: static;
    order: -1;
  }

  .investi-single-post__toc-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .investi-single-post {
    width: min(100%, calc(100% - 16px));
    padding: 24px 0 48px;
  }

  .investi-single-post__article {
    border-radius: 22px;
  }

  .investi-single-post__header {
    padding: 24px 18px 18px;
  }

  .investi-single-post__featured-image {
    padding: 0 18px;
  }

  .investi-single-post__featured-image-tag {
    border-radius: 0;
  }

  .investi-single-post__layout {
    padding: 22px 18px 24px;
  }

  .investi-single-post__toc-card {
    padding: 16px;
    border-radius: 18px;
  }

  .investi-single-post__content {
    padding: 20px 18px 22px;
    border-radius: 20px;
  }
}
