.et_pb_section.counter-med-tekst-panel {
  padding-top: 56px !important;
  padding-bottom: 56px !important;
  margin: 56px 0;
  --counter-value-size: clamp(2rem, 3.6vw, 3.4rem);
  --counter-value-size-mobile: clamp(1.7rem, 8vw, 2.3rem);
  --counter-icon-size: clamp(26px, 2.6vw, 38px);
  --counter-icon-gap: 12px;
}

.et_pb_section.counter-med-tekst-panel.counter-med-tekst-has-bg {
  background-color: var(--counter-panel-bg, var(--color-bg-light, #f7f1e8)) !important;
  padding-top: 72px !important;
  padding-bottom: 72px !important;
  margin-top: 0;
  margin-bottom: 0;
}

/* Guard against Divi per-section spacing overrides when background is enabled */
.et_pb_section.counter-med-tekst-panel.counter-med-tekst-has-bg .et_pb_row {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

.counter-med-tekst-overskrift {
  margin-bottom: 10px;
}

.counter-med-tekst-panel .panel-beskrivelse {
  margin-bottom: 40px;
}

.counter-med-tekst-panel.counter-med-tekst-no-desc .counter-med-tekst-overskrift {
  margin-bottom: 34px;
}

.counter-med-tekst-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 56px 60px;
}

.counter-med-tekst-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.counter-med-tekst-item-content {
  min-width: 0;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline .counter-med-tekst-item-content {
  display: block;
}

.counter-med-tekst-inline-line {
  margin: 0;
  padding-bottom: 0 !important;
  line-height: 1.18;
}

.counter-med-tekst-inline-line .counter-med-tekst-label,
.counter-med-tekst-inline-line .counter-med-tekst-value {
  display: inline;
  vertical-align: baseline;
}

.counter-med-tekst-inline-line .counter-med-tekst-value {
  display: inline-block;
  line-height: 0.92;
  vertical-align: -0.04em;
}

.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-left,
.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-right {
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 12px;
}

.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-left .counter-med-tekst-icon,
.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-right .counter-med-tekst-icon {
  align-self: start;
  margin-top: 0.12em; /* visually align icon top with first text line */
}

/* Inline counters have larger number text in first line; nudge icon down to label cap-height */
.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline.has-icon.counter-med-tekst-item--icon-left .counter-med-tekst-icon,
.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline.has-icon.counter-med-tekst-item--icon-right .counter-med-tekst-icon {
  margin-top: 0.36em;
}

.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-right .counter-med-tekst-icon {
  order: 2;
}

.counter-med-tekst-icon {
  width: var(--counter-icon-size);
  height: var(--counter-icon-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.counter-med-tekst-item.has-icon.counter-med-tekst-item--icon-top {
  row-gap: var(--counter-icon-gap);
}

/* Keep cards aligned when some top-layout items have no icon. */
.counter-med-tekst-item.counter-med-tekst-item--icon-top:not(.has-icon) .counter-med-tekst-item-content {
  padding-top: calc(var(--counter-icon-size) + var(--counter-icon-gap));
}

/* Keep left-aligned icon rows on the same text rail even when icon is missing. */
.counter-med-tekst-item.counter-med-tekst-item--icon-left:not(.has-icon) .counter-med-tekst-item-content {
  padding-left: calc(var(--counter-icon-size) + 12px);
}

.counter-med-tekst-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.counter-med-tekst-value {
  margin: 0;
  padding-bottom: 0 !important;
  font-size: var(--counter-value-size) !important;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  display: inline-block;
  transform-origin: left bottom;
  transition: transform .18s ease, opacity .18s ease;
  will-change: transform;
}

.counter-med-tekst-label {
  margin: 0;
  padding-bottom: 0 !important;
  line-height: 1.28;
  font-size: clamp(1.05rem, 1.45vw, 1.9rem) !important;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline .counter-med-tekst-label--before {
  margin-bottom: 0;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline .counter-med-tekst-label--after {
  margin-top: 0;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-inline .counter-med-tekst-value {
  line-height: 0.92;
}

.counter-med-tekst-value.counter-tick {
  animation: counterDateTick .16s cubic-bezier(.2,.75,.25,1) both;
}

@keyframes counterDateTick {
  0% {
    transform: scale(0.97);
    opacity: 0.45;
    filter: blur(0.45px);
  }
  70% {
    transform: scale(1.015);
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-stacked .counter-med-tekst-item-content {
  display: block;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-stacked .counter-med-tekst-label--before {
  margin-bottom: 0;
}

.counter-med-tekst-item--counter.counter-med-tekst-item--text-stacked .counter-med-tekst-label--after {
  margin-top: 0;
}

.counter-med-tekst-statement {
  margin: 0;
  padding-bottom: 0 !important;
  line-height: 1.28;
  font-size: clamp(1.1rem, 1.5vw, 2rem) !important;
}

@media (max-width: 980px) {
  .counter-med-tekst-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .et_pb_section.counter-med-tekst-panel {
    padding-top: 36px !important;
    padding-bottom: 36px !important;
    margin: 36px 0;
  }

  .et_pb_section.counter-med-tekst-panel.counter-med-tekst-has-bg {
    padding-top: 44px !important;
    padding-bottom: 44px !important;
    margin-top: 0;
    margin-bottom: 0;
  }

  .et_pb_section.counter-med-tekst-panel.counter-med-tekst-has-bg .et_pb_row {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .counter-med-tekst-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .counter-med-tekst-label {
    font-size: 1.1rem !important;
  }

  .counter-med-tekst-value {
    font-size: var(--counter-value-size-mobile) !important;
  }
}
