/*!
 * TCM News Extended – base styles (grid, slider, controls, helpers).
 * (C) 2026 The Creatives Marketing Agentur GmbH – https://tcm.marketing – GPL-2.0-or-later
 */

/* ------------------------------------------------------------------ defaults and resets (low specificity) */
.tcmne {
  --tcmne-gap: 20px;
  --tcmne-cols: 3;
  --tcmne-card-h: 320px;
  --tcmne-accent: #2d72bb;
  --tcmne-ink: #1e2452;
  --tcmne-radius: 4px;
  --tcmne-ease: cubic-bezier(.22, .61, .36, 1);
  position: relative;
  box-sizing: border-box;
  max-width: 100%;
  color: var(--tcmne-ink);
}

:where(.tcmne) *,
:where(.tcmne) *::before,
:where(.tcmne) *::after {
  box-sizing: border-box;
}

:where(.tcmne) :is(h1, h2, h3, h4, h5, h6, p, ul, ol, figure, hr) {
  margin: 0;
  padding: 0;
}

:where(.tcmne) :is(ul, ol) {
  list-style: none;
}

:where(.tcmne) img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
  -webkit-user-drag: none;
}

:where(.tcmne) a {
  text-decoration: none;
  color: inherit;
}

:where(.tcmne) :is(h1, h2, h3, h4, h5, h6) {
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
}

.tcmne-icon {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -.125em;
}

.tcmne [hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ helpers */
.tcmne__sr,
.tcmne__iconlink > span:first-child {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.tcmne a:focus-visible,
.tcmne button:focus-visible {
  outline: 2px solid var(--tcmne-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ grid */
.tcmne--grid .tcmne__list {
  display: grid;
  grid-template-columns: repeat(var(--tcmne-cols), minmax(0, 1fr));
  gap: var(--tcmne-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tcmne--grid .tcmne__cell {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tcmne__cell > * {
  height: 100%;
}

/* ------------------------------------------------------------------ slider */
.tcmne--slider {
  display: flex;
  flex-direction: column;
}

.tcmne__stage {
  position: relative;
  order: 1;
  display: flow-root;
  min-width: 0;
}

.tcmne__viewport {
  /* Room for card shadows that would otherwise be clipped. */
  margin: -14px 0;
  padding: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  touch-action: pan-y pinch-zoom;
}

.tcmne--ready .tcmne__viewport {
  overflow: hidden;
  scroll-snap-type: none;
}

.tcmne--slider .tcmne__list {
  display: flex;
  flex-wrap: nowrap;
  margin: 0 calc(var(--tcmne-gap) / -2);
  padding: 0;
  list-style: none;
  will-change: transform;
}

.tcmne--slider .tcmne__cell {
  flex: 0 0 calc(100% / var(--tcmne-cols));
  max-width: calc(100% / var(--tcmne-cols));
  min-width: 0;
  padding: 0 calc(var(--tcmne-gap) / 2);
  scroll-snap-align: start;
}

.tcmne--dragging .tcmne__list {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.tcmne--dragging .tcmne__list a,
.tcmne--dragging .tcmne__list img {
  pointer-events: none;
}

/* ------------------------------------------------------------------ navigation buttons */
.tcmne {
  --tcmne-nav-bg: #1c1f26;
  --tcmne-nav-fg: #fff;
  --tcmne-nav-bd: transparent;
}

.tcmne--navstyle-light {
  --tcmne-nav-bg: #fff;
  --tcmne-nav-fg: #1c1f26;
  --tcmne-nav-bd: rgba(0, 0, 0, .14);
}

.tcmne__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--tcmne-nav-fg);
  background: var(--tcmne-nav-bg);
  border: 1px solid var(--tcmne-nav-bd);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  cursor: pointer;
  transition: background-color .2s, color .2s, opacity .2s, transform .2s;
}

.tcmne--navshape-round .tcmne__btn {
  border-radius: 50%;
}

.tcmne__btn:hover:not(:disabled) {
  background: var(--tcmne-accent);
  border-color: var(--tcmne-accent);
  color: #fff;
}

.tcmne__btn:disabled {
  opacity: .35;
  cursor: default;
}

/* center: arrows overlay the left/right edge */
.tcmne--nav-center .tcmne__nav {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.tcmne--nav-center .tcmne__btn {
  position: absolute;
  top: 50%;
  margin-top: -20px;
  pointer-events: auto;
}

.tcmne--nav-center .tcmne__btn--prev {
  left: 8px;
}

.tcmne--nav-center .tcmne__btn--next {
  right: 8px;
}

/* top-right / bottom-right: arrows above or below the cards */
.tcmne--nav-top-right .tcmne__nav,
.tcmne--nav-bottom-right .tcmne__nav {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.tcmne--nav-top-right .tcmne__nav {
  order: 0;
  margin-bottom: 12px;
}

.tcmne--nav-bottom-right .tcmne__nav {
  order: 2;
  margin-top: 12px;
}

/* ------------------------------------------------------------------ dots and pause toggle */
.tcmne__foot {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  min-height: 24px;
}

.tcmne__dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.tcmne__dot {
  position: relative;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.tcmne__dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 999px;
  background: currentColor;
  opacity: .28;
  transition: width .25s var(--tcmne-ease), margin .25s var(--tcmne-ease), opacity .2s, background-color .2s;
}

.tcmne__dot:hover::after {
  opacity: .55;
}

.tcmne__dot[aria-current="true"]::after {
  width: 24px;
  margin-left: -12px;
  background: var(--tcmne-accent);
  opacity: 1;
}

.tcmne__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .7;
  cursor: pointer;
  transition: opacity .2s, background-color .2s, color .2s;
}

.tcmne__toggle:hover {
  opacity: 1;
  background: var(--tcmne-accent);
  border-color: var(--tcmne-accent);
  color: #fff;
}

.tcmne__toggle .tcmne__toggle-play,
.tcmne--paused .tcmne__toggle .tcmne__toggle-pause {
  display: none;
}

.tcmne--paused .tcmne__toggle .tcmne__toggle-play {
  display: inline-block;
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tcmne *,
  .tcmne *::before,
  .tcmne *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ shared pieces for templates (zero specificity) */
:where(.tcmne [class*="__media"]) {
  position: relative;
  overflow: hidden;
}

:where(.tcmne img[class*="__img"], .tcmne img[class*="__blur"]) {
  width: 100%;
  object-fit: cover;
}

:where(.tcmne [class*="__text"] > :first-child) {
  margin-top: 0;
}

:where(.tcmne [class*="__text"] > :last-child) {
  margin-bottom: 0;
}

:where(.tcmne [class*="__text"] p) {
  margin: 0 0 .6em;
}

:where(.tcmne [class$="__meta"]) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: .8125rem;
  line-height: 1.4;
}

:where(.tcmne [class$="__meta"] a):hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ chosen image ratio (all templates with flexible image height) */
.tcmne--ratio img[class*="__img"] {
  height: auto;
  aspect-ratio: var(--tcmne-ratio);
  object-fit: cover;
}
