/* KARTA (výpis/teaser) */
.teaser-card{
  position:relative;
  display:inline-block; /* šířka přesně podle obsahu (fotky) */
  vertical-align:top;
}

/* ODKAZ S FOTKOU – rodič overlaye */
.teaser-image{
  position:relative;
  display:inline-block;  /* shrink-wrap: žádné přetékání přes foto */
  overflow:hidden;
  vertical-align:top;
  text-decoration:none;
  line-height:0; /* zabije baseline mezeru pod img */
}

/* FOTKA */
.teaser-image img{
  display:block;
  width:auto;            /* nepřetahuj na 100% kontejneru */
  max-width:100%;        /* ale dovol zmenšit v mřížce */
  height:auto;
  transition:transform .35s ease;
}

/* Jemný hover na fotce */
.teaser-image:hover img{
  transform:scale(1.03);
}

/* OVERLAY S PEREXEM – ve fotce, bez přesahu */
.teaser-overlay{
  position:absolute;
  font-weight:100;
  left:0; right:0; bottom:18px; top:auto;
  z-index:2;                             /* overlay vždy nad fotkou */
  padding:14px 16px 15px;
  color:#fff !important;
  line-height:1.45;
  font-size:0.98rem;
  background: rgba(0, 0, 0, .55);
  overflow:hidden;
  display: flex;
  justify-content: center; /* Zarovnání na střed horizontálně */
  align-items: flex-end;
  box-sizing: border-box; 

  max-height:30%;
  transition:max-height .25s ease, background-color .25s ease;

  /* aby šel klikat obrázek pod overlayem */
  pointer-events: none;
}
.teaser-overlay * { pointer-events: none; }

/* Vnitřní text overlaye s line clampem */
.teaser-text {
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
  width:100%;
  margin:0;
  font-family: system-ui;
  text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.7);
}

/* Odstavce uvnitř textu */
.teaser-text p {
  margin:0; color: #fff !important;
}

.teaser-image:hover .teaser-overlay{
  max-height:80%;
  background:linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,0) 75%);
}

.teaser-overlay a {color: #fff !important; }

/* VOLITELNÉ: jemné zvýraznění textu uvnitř overlaye */
/* .teaser-overlay{ backdrop-filter: blur(3px) } */

/* ZBYTEK POLÍ POD FOTKOU (nezasahuje do overlaye) */
.teaser-rest{ margin-top:10px }

/* Sníží mezeru mezi datem a kartou v náhledu */
.node-view-mode-teaser .node-content.teaser-card {
  margin-top: 0px; /* Můžete nastavit na 0, pokud tam nechcete žádnou mezeru */
}

/* --- MOBIL: spolehlivý overlay na fotce, bez překryvů --- */
@media (max-width: 768px){

  /* ať karta zabere plnou šířku řádku, ne inline gapy */
  .teaser-card { display:block; width:100%; }

  /* fotka – zpět do normálního toku, ať nezmizí */
  .teaser-image{
    display:block;
    width:100%;
    position:relative;
    overflow:hidden;
  }
  .teaser-image img{
    position:static;      /* ← žádné absolute/inset/object-fit */
    width:100%;
    height:auto;
    transform:none;
  }

  /* overlay odspodu, posun do fotky si řídíš vlastním top calc, nechávám tvůj princip */
  .teaser-overlay{
    top: calc(100% - 38%);
    bottom:0; left:0; right:0;
    padding:12px 14px;
    background: rgba(0,0,0,.55);
    z-index:2;
    height:auto;          /* fit-content pryč – lepší kompatibilita */
    box-sizing:border-box;
    justify-content: center;
    align-items: center;
    font-size:1rem;
  }

  /* text – 4 řádky, bez rozbalování na hover (mobil) */
  .teaser-text{
    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
    line-height: 1.2rem;
  }

  /* hover na mobilu neřešíme */
  .teaser-image:hover .teaser-overlay{ background: rgba(0,0,0,.55); }
  .teaser-image:hover .teaser-text{ -webkit-line-clamp:4; }
}
