.euroviz-chart {
  --euroviz-color-text-light: #1f1f1f;
  --euroviz-color-text-secondary-light: #424242;
  --euroviz-color-text-tertiary-light: #888888;

  --euroviz-color-text-dark: #f5f5f5;
  --euroviz-color-text-secondary-dark: #e7e7e7;
  --euroviz-color-text-tertiary-dark: #b1b1b1;

  --euroviz-color-text: var(--euroviz-color-text-light);
  --euroviz-color-text-secondary: var(--euroviz-color-text-secondary-light);
  --euroviz-color-text-tertiary: var(--euroviz-color-text-tertiary-light);
}

@media (prefers-color-scheme: dark) {
  .euroviz-chart.euroviz-chart--darkmode-enabled {
    --euroviz-color-text: var(--euroviz-color-text-dark);
    --euroviz-color-text-secondary: var(--euroviz-color-text-secondary-dark);
    --euroviz-color-text-tertiary: var(--euroviz-color-text-tertiary-dark);
  }
}

.euroviz-chart.euroviz-chart--darkmode-enabled.euroviz-chart--force-dark {
  --euroviz-color-text: var(--euroviz-color-text-dark);
  --euroviz-color-text-secondary: var(--euroviz-color-text-secondary-dark);
  --euroviz-color-text-tertiary: var(--euroviz-color-text-tertiary-dark);
}

.euroviz-chart.euroviz-chart--darkmode-enabled.euroviz-chart--force-light {
  --euroviz-color-text: var(--euroviz-color-text-light);
  --euroviz-color-text-secondary: var(--euroviz-color-text-secondary-light);
  --euroviz-color-text-tertiary: var(--euroviz-color-text-tertiary-light);
}

@media (prefers-color-scheme: dark) {
  .euroviz-chart--darkmode-enabled.euroviz-chart--standalone {
    background-color: #1f1f1f;
  }

  body:has(.euroviz-chart--darkmode-enabled.euroviz-chart--standalone) {
    background-color: #1f1f1f;
  }
}
.euroviz-chart.euroviz-chart--darkmode-enabled.euroviz-chart--standalone.euroviz-chart--force-dark {
  background-color: #1f1f1f;
}
body:has(
    .euroviz-chart--darkmode-enabled.euroviz-chart--standalone.euroviz-chart--force-dark
  ) {
  background-color: #1f1f1f;
}

.euroviz-chart {
  color: var(--euroviz-color-text);
  position: relative;
  z-index: 0;
  box-sizing: content-box;
  font-size: 20px;
  line-height: 28px;
}

.euroviz-chart a {
  color: var(--euroviz-color-text) !important;
  text-decoration: underline;
}

.euroviz-chart__heading {
  font-weight: bold;
  margin-bottom: 20px;
  font-size: 24px;
  line-height: 125%;
}

.euroviz-chart__description {
  font-size: 18px;
  font-weight: normal;
  margin-top: -15px;
  margin-bottom: 20px;
  line-height: 25px;
  color: var(--euroviz-color-text-secondary);
}

.euroviz-chart__bottom {
  margin-top: 15px;
}

.euroviz-chart__content {
  position: relative;
  font-size: 14px;
  line-height: 16px;
}

.euroviz-chart__bottom {
  font-size: 13px;
  line-height: 17px;
}

.euroviz-chart__byline {
  margin-top: 5px;
  color: var(--euroviz-color-text-secondary);
}

.euroviz-chart__byline span {
  margin-right: 10px;
}

.euroviz-chart__attribution {
  margin-top: 5px;
  color: var(--euroviz-color-text-tertiary);
}

.euroviz-chart__attribution a {
  color: var(--euroviz-color-text-tertiary) !important;
  text-decoration: underline;
}

.euroviz-chart__heading:empty,
.euroviz-chart__description:empty,
.euroviz-chart__byline:empty,
.euroviz-chart__attribution:empty,
.euroviz-chart__bottom-close:empty,
.euroviz-chart__bottom-open:empty {
  display: none;
}

.euroviz-chart__top:has(.euroviz-chart__heading:empty):has(.euroviz-chart__description:empty) {
  display: none;
}

.euroviz-chart__bottom:has(.euroviz-chart__byline:empty):has(.euroviz-chart__attribution:empty) {
  display: none;
}

@media (max-width: 550px) {
  .euroviz-chart {
    font-size: 18px;
    line-height: 28px;
  }

  .euroviz-chart__heading {
    font-size: 20px;
    line-height: 125%;
  }

  .euroviz-chart__description {
    font-size: 17px;
    line-height: 24px;
  }
}

.euroviz-chart__bottom-close,
.euroviz-chart__bottom-open {
  margin-top: 15px;
  margin-bottom: 10px;
  color: var(--euroviz-color-text);
  font-weight: 600;
  display: none;
  cursor: pointer;
}

.euroviz-chart__bottom-close::after,
.euroviz-chart__bottom-open::after {
  content: " ";
  display: inline-block;
  width: 13px;
  cursor: pointer;
  height: 13px;
  margin-left: 5px;
  background-position: center center;
  background-size: contain;
  background-repeat: no-repeat;
  position: relative;
  top: 2px;
}

.euroviz-chart__bottom-open::after {
  background-image: url(icons/more.svg);
}

.euroviz-chart__bottom-close::after {
  background-image: url(icons/less.svg);
}

.euroviz-chart--hide-bottom .euroviz-chart__bottom-close {
  display: block;
}

.euroviz-chart--hide-bottom.euroviz-chart--bottom-hidden .euroviz-chart__byline,
.euroviz-chart--hide-bottom.euroviz-chart--bottom-hidden
  .euroviz-chart__attribution,
.euroviz-chart--hide-bottom.euroviz-chart--bottom-hidden
  .euroviz-chart__bottom-close {
  display: none;
}

.euroviz-chart--hide-bottom.euroviz-chart--bottom-hidden
  .euroviz-chart__bottom-open {
  display: block;
}

.euroviz-chart--edit .euroviz-chart__heading,
.euroviz-chart--edit .euroviz-chart__description,
.euroviz-chart--edit .euroviz-chart__byline {
  position: relative;
  border: 1px dashed #ccc;
  border-radius: 2px;
  padding: 5px 0;
  outline: none;
}

.euroviz-chart--edit .euroviz-chart__heading:focus,
.euroviz-chart--edit .euroviz-chart__description:focus,
.euroviz-chart--edit .euroviz-chart__byline:focus {
  border: 1px dashed #555;
}

.euroviz-chart--edit .euroviz-chart__heading:empty,
.euroviz-chart--edit .euroviz-chart__description:empty,
.euroviz-chart--edit .euroviz-chart__byline:empty,
.euroviz-chart--edit .euroviz-chart__top,
.euroviz-chart--edit .euroviz-chart__bottom {
  display: block;
}

.euroviz-chart--edit .euroviz-chart__heading::after,
.euroviz-chart--edit .euroviz-chart__description::after,
.euroviz-chart--edit .euroviz-chart__byline::after {
  content: " ";
  width: 14px;
  height: 14px;
  opacity: 0.4;
  position: absolute;
  top: 2px;
  right: 2px;
  background-image: url(icons/pen.svg);
  background-size: contain;
  background-repeat: no-repeat;
}

/* =============================================================================
   Expandable Byline
   ============================================================================= */

/* The byline toggle and its collapsing wrapper are always in the DOM whenever there is a
   byline; `html[data-byline]` decides whether they behave as a toggle. It is written
   server-side from the project/graphic setting and overridden by ?expandable_byline
   before first paint. Everything here is scoped to that state, so a plain byline is
   never clipped — including when this stylesheet is a stale cached copy. */

.euroviz-chart__bottom-toggle {
  display: none;
  margin-top: 20px;
  margin-bottom: 5px;
}

html[data-byline="expandable"] .euroviz-chart__bottom-toggle {
  display: block;
}

html[data-byline="expandable"] .euroviz-chart__bottom-open,
html[data-byline="expandable"] .euroviz-chart__bottom-close {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--euroviz-color-text);
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
}

html[data-byline="expandable"] .euroviz-chart__bottom-open:hover,
html[data-byline="expandable"] .euroviz-chart__bottom-close:hover {
  text-decoration: underline;
}

/* Collapsible content - smooth transition using CSS grid */
html[data-byline="expandable"] .euroviz-chart__bottom-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

html[data-byline="expandable"] .euroviz-chart__bottom-collapse .euroviz-chart__bottom-content-inner {
  overflow: hidden;
}

/* States: collapsed (default) */
html[data-byline="expandable"] .euroviz-chart__bottom-open {
  display: block;
}

html[data-byline="expandable"] .euroviz-chart__bottom-close {
  display: none;
}

/* States: expanded */
html[data-byline="expandable"] .euroviz-chart--byline-expanded .euroviz-chart__bottom-open {
  display: none;
}

html[data-byline="expandable"] .euroviz-chart--byline-expanded .euroviz-chart__bottom-close {
  display: block;
}

html[data-byline="expandable"] .euroviz-chart--byline-expanded .euroviz-chart__bottom-collapse {
  grid-template-rows: 1fr;
}

/* =============================================================================
   Chrome (?plain)
   ============================================================================= */

html[data-chrome="none"] .euroviz-chart__top,
html[data-chrome="none"] .euroviz-chart__bottom {
  display: none;
}

/* =============================================================================
   Fixed height (?fixed_height)
   ============================================================================= */

/* Set server-side to "no" on <html>, overridden to "yes" by the head script when
   the embed is loaded with ?fixed_height. Only the "yes" state is styled; the
   default has no rules, so ordinary embeds are unaffected — including under a stale
   cached copy of this stylesheet. The chain gives the shell a definite height and a
   flex column so the graphic can fill exactly the fixed iframe box; each graphic
   makes one inner stage flex:1 (gated on its isFixedHeight prop). */
html[data-fixed-height="yes"],
html[data-fixed-height="yes"] body {
  height: 100%;
}

html[data-fixed-height="yes"] .euroviz-chart {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html[data-fixed-height="yes"] .euroviz-chart__top,
html[data-fixed-height="yes"] .euroviz-chart__bottom {
  flex: 0 0 auto;
}

html[data-fixed-height="yes"] .euroviz-chart__content,
html[data-fixed-height="yes"] #euroviz-provider-container {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Dark mode icon support */
@media (prefers-color-scheme: dark) {
  .euroviz-chart.euroviz-chart--darkmode-enabled:not(.euroviz-chart--force-light) .euroviz-chart__bottom-open::after,
  .euroviz-chart.euroviz-chart--darkmode-enabled:not(.euroviz-chart--force-light) .euroviz-chart__bottom-close::after {
    filter: invert(1);
  }
}

.euroviz-chart--darkmode-enabled.euroviz-chart--force-dark .euroviz-chart__bottom-open::after,
.euroviz-chart--darkmode-enabled.euroviz-chart--force-dark .euroviz-chart__bottom-close::after {
  filter: invert(1);
}
