/* remove margins & padding */
.npf_row, .npf_col, .tmblr-full, .tmblr-full img:not(.npf_audio img){
    margin:0!important;
    padding:0!important;
}

/* npf row */
.npf_row {
    width:100%!important;
    align-items:flex-start!important;
}

/* npf spacing: ROW */
.npf_inst > * + *,
.npf_inst + .npf_inst {
    margin-top:var(--NPF-Images-Spacing)!important;
}

/* npf spacing: COLUMN */
.npf_row > * + * {
    margin-left:var(--NPF-Images-Spacing)!important;
}

.tmblr-full img:not(.npf_audio img){
    position:relative!important; /* remove position:absolute from photos */
    width:auto; /* stop small images from stretching */
    min-width:0!important;
    max-width:100%!important;
}

/* temporarily v-stretch imgs */
.npf_col:not([data-ready]),
.npf_col:not([data-ready]) > * {
    align-self:stretch!important;
}

/* stop images from overflowing */
.tmblr-full img {
    max-width:100%;
}

/*---------------------*/

/* [1/2] cursor: pointer to indicate that it's clickable */
.npf_inst.npf_photo img {
    cursor:pointer;
}

/* [2/2] remove cursor:pointer from <a> anchors bc it doesn't fit to the image itself */
a.post_media_photo_anchor {
    cursor:default!important;
}

/*---------------------*/

/* npf videos & audio */
.tmblr-full video, .tmblr-full audio[controls]:not(.npf_audio audio[controls]){
    vertical-align:middle!important;
    margin:0!important;
    padding:0!important;
    width:100%!important;
    max-width:100%!important;
}

/* v middle */
.tmblr-full img {
    vertical-align:middle;
}

/*---------------------*/

/* non-image npf media */
.npf_inst > [data-npf]{
    width:100%!important;
    margin:0!important;
}

.npf_inst > [data-npf] iframe {
    display:block!important;
    width:100%!important;
    max-width:100%!important;
}

/*---------------------*/

/* npf images: true center */
.npf_row > .npf_col {
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:center!important;
}

/*---------------------*/

/* npf overflow hidden */
.npf_row, .npf_col {
    overflow:hidden!important;
}

/* NOT overflow hidden */
.npf_row:has(p.tmblr-attribution), .npf_col:has(p.tmblr-attribution), .tmblr-full:has(p.tmblr-attribution){
    overflow:initial!important;
}

/*---------------------*/

.npf_row[data-npf-height] .npf_col {
    height:auto!important;
}

.npf_row[data-npf-height] .npf_col .tmblr-full {
    position:relative!important;
    height:0!important;
    padding-bottom:var(--npf-img-pct)!important;
}

.npf_row[data-npf-height] .npf_col .tmblr-full > *:first-child {
    position:absolute!important;
    top:0;left:0;
    width:100%;
    height:100%;
}

.npf_row[data-npf-height] .npf_col .tmblr-full > *:not(:first-child){
    display:none;
}

/*---------------------*/

/* remove potentially unwanted cosmetics from npf */
a.post_media_photo_anchor {
    padding:0!important;
    border:none!important;
    box-shadow:none!important;
}

.photo-origin img:not(.audio-caption img, .npf_audio img, .tmblr-full img){
    border-radius:0!important;
}

/*---------------------*/

@supports (width: fit-content){
    .npf-small:has(> .npf_photo):not(:has(> *:not(.npf_photo))){
        width:fit-content;
    }
}