/***************************/
/* 2024 NOV 14 : R__Photos Modular CSS
/***************************/
/* Extra Custom Properties */
/***************************/
:root {
    --rfs-12: 12rem;    /* massive (for icons, not text pls!) */
}




/* =========================================================================
======       ===    ==       ===        ==  ====  ====     ===  ====  ======
======  ====  ===  ===  ====  =====  =====   ==   ===  ===  ==  ====  ======
======  ====  ===  ===  ====  =====  ======  ==  ===  ========  ====  ======
======  ====  ===  ===  ====  =====  ======  ==  ===  ========  ====  ======
======  ====  ===  ===       ======  =======    ====  ========        ======
======  ====  ===  ===  ===========  ========  =====  ========  ====  ======
======  ====  ===  ===  ===========  ========  =====  ========  ====  ======
======  ====  ===  ===  ===========  ========  ======  ===  ==  ====  ======
======       ===    ==  ===========  ========  =======     ===  ====  ======
============================================================================
// 2024 DEC 06 : Two thumbnails side by side. If no space hide the second
<figure class="scp-diptych">
    <a><figure></figure></a>
    <a><figure></figure></a>
    <figcaption>Rudy in <?=$Stats->human?></figcaption>
</figure>
*/
.scp-diptych,
.scp-triptych {
    container-name: diptych;
    container-type: inline-size;
    width:100%;
    display: flex;
    justify-content: center;
    gap: 1ch;
    margin-bottom:2rem;
}
.scp-diptych figure > figcaption,
.scp-triptych figure > figcaption {
    display:none;
}
.scp-diptych > figcaption,
.scp-triptych > figcaption {
    position: absolute;
    inset: auto;
    bottom: -1rem;
    width: 100%;
    font-size:var(--rfs-1);
}
.scp-triptych > a {
    max-width:30% !important;
}
.scp-triptych img {
    aspect-ratio:4/5;
    object-fit: cover;
    max-width:100% !important;
}
@container diptych (width < 300px) {
    .scp-diptych > *:nth-child(2),
    .scp-triptych > *:nth-child(n+2) {
        display:none;
    }
}

/* =========================================================================================================
======       ======================      ======  =====  ========  ========        ==       ===  ====  ======
======  ====  ====================   ==   ====    ====  ========  ========  ========  ====  ==   ==   ======
======  ====  ====================  ====  ===  ==  ===  ========  ========  ========  ====  ===  ==  =======
======  ===   ====================  ========  ====  ==  ========  ========  ========  ===   ===  ==  =======
======      ======================  ========  ====  ==  ========  ========      ====      ======    ========
======  ====  ====================  ===   ==        ==  ========  ========  ========  ====  =====  =========
======  ====  ====================  ====  ==  ====  ==  ========  ========  ========  ====  =====  =========
======  ====  ====================   ==   ==  ====  ==  ========  ========  ========  ====  =====  =========
======  ====  =                  ==      ===  ====  ==        ==        ==        ==  ====  =====  =========
============================================================================================================
// 2024 JUL 07 : 2024 SEP 01 (squared images)
// 2024 NOV 13 : "lightboxable" is now the new default thumbnail version
    <a href="/photo/{{hexID}}"><figure class="r__lightboxable">
        <img src="{{thumb_src}}" alt="{{alt_text}}">
        <figcaption>{{caption}}<time datetime="{{Y-m-d H:i}}">{{M Y}}</time></figcaption>
    </figure></a>
// SPOILTCAT'S LIGHTBOX */
a:has(.r__lightboxable) {cursor:zoom-in;}
/* :not(dialog) > .r__lightboxable > img+figcaption { display: none; } */
#R__Lightbox img {
    width: 100%;
    object-fit:contain;
    opacity: 0;
    animation-name: lightbox-zoom;
    animation-fill-mode: forwards;
    animation-duration: 0.6s;
    animation-timing-function: ease-out;
}
@keyframes lightbox-zoom {
    from {opacity:0;transform:scale(1)}
    to {opacity:1;transform:scale(1)}
}
@media (prefers-color-scheme: light) {
    :root {--modal-background:whitesmoke;--modal-text:var(--night);}
}
@media (prefers-color-scheme: dark) {
    :root {--modal-background:var(--night);--modal-text:whitesmoke;}
}

#R__Lightbox {
    height:100%;
    padding: 2.5ch 1ch;
    background: var(--modal-background);
    outline: none;
    border: unset;
}
#R__Lightbox::backdrop {
    background: var(--modal-background);
}
#R__Lightbox figure {
    height:100%;
    display: grid;
    align-items: end;
}
#R__Lightbox figcaption {
    padding:1ch;
    font-size:var(--rfs-4);
    white-space: pre-line;
    color: var(--modal-text);
    text-wrap: balance;
    background: linear-gradient(to right, transparent, hsla(0,0%,50%,0.1) 5%, hsla(0,0%,50%,0.1) 95%, transparent);
    box-shadow: inset 0px -4px 10px 0px var(--modal-background);
}
#R__Lightbox figcaption time {
    font-size:var(--rfs-2);
    font-family: serif;
    font-style: italic;
}

/* 2024 NOV 14 */
/* SFCnav : next/previous image links */
.SFCnav {
    cursor:pointer;
    font-size: var(--rfs-12);
    position:absolute;
    top:0;
    line-height: 80dvh;
    z-index: 6;
    animation: fade-away ease-in-out 1s forwards;
}
.SFCnav.prev {float:left;left:0}
.SFCnav.next {float:right;right:0}
@keyframes fade-away {
    from {opacity: 0.4;}
      to {opacity: 0;}
}
.SFCnav:hover {
    transition: opacity 2s;
    opacity: 0.1 !important;
    filter: invert(1);
    background: var(--gray);
}
/* The <dialog> close button */
.SCFclose {
    z-index: 9;
    position: absolute;
    top: 0;
    right: 0;
    font-size: var(--rfs-6);
    filter: invert(1);
    width: 4ch;
    aspect-ratio: 1;
    text-align:right;
    cursor:zoom-out;
}

.r__gallery-thumbs {
    container-name: r__gallery;
}
.r__gallery-thumbs {
    container-type: inline-size;
    align-self:self-start;
    width:100%;
    margin-inline: auto;
    padding-inline:1ch;
    display: grid;
    align-content:center;
    grid-template-columns: repeat(12, minmax(30px, 1fr));
    justify-content: space-around;
    justify-items: stretch;
    align-items: stretch;

    width:96%;
    /* grid-column:1/-1; */
}
/* .r__gallery-thumbs figure, */
.r__gallery-thumbs a {
    display:contents;           /* ignore wrapper markup for css flex/grid */
}
.r__gallery-thumbs figcaption {
    position: absolute;
    font-size: var(--rfs-1);
    width: calc(100% - 8px);
    left: 4px;
    bottom: -1.4ch;
    padding: 2px;
    border-radius: 0 0 4px 4px;
    background: hsla(0,0%,0%,0.4);
    color: whitesmoke;
    opacity: 0;     /* hides caption until hover/zoom-in */
}
.r__gallery-thumbs img {
    object-fit:cover;
    width: 100%;
    max-width:min-content;    /* this is the size of thumbnails on disk */
    aspect-ratio: 1;
    padding:4px;        /* gap between images */

    /* height:150px; */
    /* min-width:fit-content; */
}


.r__gallery-thumbs.rpg-featured {
    order:-1;
    align-self:self-end;
}
.r__gallery-thumbs.rpg-featured.rpg-2 img {
    grid-column: span 6 !important;
}
.r__gallery-thumbs.rpg-featured.rpg-3 img {
    grid-column: span 4 !important;
}


/* ======================================================================================================================
=======      =====     ===  =====  ==  ==================       ===  ====  ====    ====        ====    =====      =======
======  ====  ===  ===  ==   ===   ==  ==================  ====  ==  ====  ===  ==  ======  ======  ==  ===  ====  ======
======  ====  ==  ========  =   =  ==  ==================  ====  ==  ====  ==  ====  =====  =====  ====  ==  ====  ======
=======  =======  ========  == ==  ==  ==================  ====  ==  ====  ==  ====  =====  =====  ====  ===  ===========
=========  =====  ========  =====  ==  ========        ==       ===        ==  ====  =====  =====  ====  =====  =========
===========  ===  ========  =====  ==  ==================  ========  ====  ==  ====  =====  =====  ====  =======  =======
======  ====  ==  ========  =====  ==  ==================  ========  ====  ==  ====  =====  =====  ====  ==  ====  ======
======  ====  ===  ===  ==  =====  ==  ==================  ========  ====  ===  ==  ======  ======  ==  ===  ====  ======
=======      =====     ===  =====  ==        ============  ========  ====  ====    =======  =======    =====      =======
====================================================================================================================== */
/* 2025 JAN 11 : scml-photos : Basic Photo Gallery grid */
scml-photos, .scml-photos {
    display: grid;
    grid-template-columns: repeat(2,auto);
    justify-items:center;
    gap:1rem;
}
scml-photos .scf-inline,
.scml-photos .scf-inline {
    height:100%;
    align-items:stretch;
}
scml-photos .scf-inline > figcaption,
.scml-photos .scf-inline > figcaption {
    display: none;
}
/* 2025 JAN 24  */
/* rpg-1c => One Large Portrait next to three thumbnails */
scml-photos.rpg-1c {grid-template-columns: 2fr 1fr;}
scml-photos.rpg-1c > *:first-child {grid-row:span 3;}
scml-photos.rpg-1c > *:first-child img {max-height:revert;}

scml-photos.diptych img {max-height:revert;}
scml-photos.triptych {
    display: grid;
    grid-template-columns: repeat(3,auto);
    gap: 1px;
    margin-block: 1rem;
}

scml-photos.masonry {
    container-name: scml-photos;
    container-type: inline-size;
    align-self:self-start;
    width:96%;
    margin-inline: auto;
    padding-inline:1ch;
    display: grid;
    align-content:center;
    grid-template-columns: repeat(12, minmax(30px, 1fr));
    justify-content: space-around;
    justify-items: stretch;
    align-items: stretch;
    gap:0;
}
scml-photos.masonry figure {
    grid-column: span 4;
}
scml-photos.masonry a {
    display:contents;           /* ignore wrapper markup for css flex/grid */
}
scml-photos.masonry figcaption {
    position: absolute;
    font-size: var(--rfs-1);
    width: calc(100% - 8px);
    left: 4px;
    bottom: -1.4ch;
    padding: 2px;
    border-radius: 0 0 4px 4px;
    background: hsla(0,0%,0%,0.4);
    color: whitesmoke;
    opacity: 0;     /* hides caption until hover/zoom-in */
}
scml-photos.masonry img {
    object-fit:cover;
    max-height:unset;           /* revert scml-photos img */
    width: 100%;
    max-width:min-content;    /* this is the size of thumbnails on disk */
    aspect-ratio: 1;
    padding:4px;        /* gap between images */
}

/* NARROW COLUMN */
@container scml-photos (width < 600px) {
    scml-photos.masonry > *:nth-child(-n+2) figure {
        grid-row: span 3;
        grid-column:span 6;
        /* aspect-ratio: 4/5; */
    }
    scml-photos.masonry > *:nth-child(12n+3) figure,
    scml-photos.masonry > *:nth-child(12n+10) figure {
        grid-row: span 2;
        grid-column: span 8;
    }
}

/* 2024 SEP 27 staggered grid */
/* =================================================================================================================================================
======  =======  =====  =====       ===       =====    ====  ====  ====  =========     =====    ====  ========  ====  ==  =====  ==  =======  ======
======   ======  ====    ====  ====  ==  ====  ===  ==  ===  ====  ====  ========  ===  ===  ==  ===  ========  ====  ==   ===   ==   ======  ======
======    =====  ===  ==  ===  ====  ==  ====  ==  ====  ==  ====  ====  =======  ========  ====  ==  ========  ====  ==  =   =  ==    =====  ======
======  ==  ===  ==  ====  ==  ===   ==  ===   ==  ====  ==  ====  ====  =======  ========  ====  ==  ========  ====  ==  == ==  ==  ==  ===  ======
======  ===  ==  ==  ====  ==      ====      ====  ====  ==   ==    ==  ========  ========  ====  ==  ========  ====  ==  =====  ==  ===  ==  ======
======  ====  =  ==        ==  ====  ==  ====  ==  ====  ===  ==    ==  ========  ========  ====  ==  ========  ====  ==  =====  ==  ====  =  ======
======  =====    ==  ====  ==  ====  ==  ====  ==  ====  ===  ==    ==  ========  ========  ====  ==  ========  ====  ==  =====  ==  =====    ======
======  ======   ==  ====  ==  ====  ==  ====  ===  ==  =====    ==    ==========  ===  ===  ==  ===  ========   ==   ==  =====  ==  ======   ======
======  =======  ==  ====  ==  ====  ==  ====  ====    =======  ====  ============     =====    ====        ===      ===  =====  ==  =======  ======
================================================================================================================================================= */
.r__gallery-thumbs figure {
    grid-column: span 4;
}
/* 2024 SEP 29 : narrow column and/or portrait screen gallery styling */
@container r__gallery (width < 600px) {
    /* first three children include the h2 header */
    .r__gallery-thumbs > *:nth-child(-n+3) figure {
        grid-row: span 3;
        grid-column:span 6;
        /* aspect-ratio: 4/5; */
    }
    .r__gallery-thumbs > *:nth-child(12n+4) figure,
    .r__gallery-thumbs > *:nth-child(12n+11) figure {
        grid-row: span 2;
        grid-column: span 8;
    }
    .rpg-3 > *:last-child figure {
        grid-column:1/-1;
    }
    /* force simple two column grid */
    .rpg-4 figure,
    .rpg-6 figure {
        grid-column:span 6 !important;
        grid-row: span 1 !important;
    }

    /* Remove large version thumbnail */
    /* .rpg-8 > *:nth-child(3) figure, */
    /* .rpg-9 > *:nth-child(3) figure {
        grid-column: span 4;
        grid-row: span 1;
    } */

    /* TWO Photos per row */
    /* .rpg-9 *:nth-last-child(-n+4) figure, */
    .rpg-10 *:nth-last-child(-n+2) figure,
    .rpg-12 *:nth-last-child(-n+4) figure,
    .rpg-13 *:nth-last-child(-n+2) figure,
    .rpg-15 *:nth-last-child(-n+4) figure,
    .rpg-24 > *:nth-last-child(-n+4) figure {
        grid-column: span 6;
        grid-row: span 2;
    }
    .rpg-7 > *:nth-last-child(-n+2) figure,
    .rpg-16 > *:nth-last-child(-n+2) figure {
        grid-column: span 6;
        grid-row: span 1;
    }

    /* THREE Photos per row */
    /* .rpg-24 > *:nth-last-child(-n+8) figure {
        grid-column: span 4;
        grid-row: span 1;
    } */
    /* FOUR Photos per row */
    .rpg-21 > *:nth-last-child(-n+4) figure {
        grid-column: span 3;
        grid-row: span 1;
    }
}


/* =====================================================================================================================
======  ====  ====  ==    ==       ===        ========      =====     ===       ===        ==        ==  =======  ======
======  ====  ====  ===  ===  ====  ==  =============  ====  ===  ===  ==  ====  ==  ========  ========   ======  ======
======  ====  ====  ===  ===  ====  ==  =============  ====  ==  ========  ====  ==  ========  ========    =====  ======
======  ====  ====  ===  ===  ====  ==  ==============  =======  ========  ===   ==  ========  ========  ==  ===  ======
======   ==    ==  ====  ===  ====  ==      ============  =====  ========      ====      ====      ====  ===  ==  ======
=======  ==    ==  ====  ===  ====  ==  ==================  ===  ========  ====  ==  ========  ========  ====  =  ======
=======  ==    ==  ====  ===  ====  ==  =============  ====  ==  ========  ====  ==  ========  ========  =====    ======
========    ==    =====  ===  ====  ==  =============  ====  ===  ===  ==  ====  ==  ========  ========  ======   ======
=========  ====  =====    ==       ===        ========      =====     ===  ====  ==        ==        ==  =======  ======
===================================================================================================================== */
/* 2024 SEP 29 : wide-screen gallerys */
@container r__gallery (width > 600px) {
    .r__gallery-thumbs figure {
        grid-column: span 2;
    }
    /* first five children include the h2 header */
    .r__gallery-thumbs > *:nth-child(-n+5) figure {
        grid-row: span 3;
        grid-column:span 3;
        /* aspect-ratio: 4/5; */
    }

    /* larger thumbanils on a standard interval */
    .r__gallery-thumbs *:nth-child(12n+7) figure,
    .r__gallery-thumbs *:nth-child(12n+12) figure {
        grid-row: span 2;
        grid-column: span 4;
    }
    /* Additional large verions thumbnails */
    .rpg-10 *:nth-child(8) figure,
    .rpg-14 *:nth-child(8) figure {
        grid-row: span 2;
        grid-column: span 4;
    }
    /* Remove large version thumbnail */
    .rpg-13 > *:nth-child(12) figure,
    .rpg-25 > *:nth-last-child(3) figure {
        grid-column: span 2;
        grid-row: span 1;
    }

    /* center-align two thumbnails in one row */
    .rpg-2 *:first-child figure {
        grid-column:3/7;
    }
    .rpg-5 *:nth-last-child(1) figure {
        grid-column: 7/11;
    }
    .rpg-5 *:nth-last-child(2) figure {
        grid-column: 3/7;
    }
    .rpg-6 figure {
        grid-column:span 4 !important;
        grid-row: span 1 !important;
    }
    .rpg-8 figure,
    .rpg-1x1 *:nth-last-child(-n+8) figure {
        grid-column:span 3 !important;
        grid-row: span 1 !important;
    }
    /* three thumbails in one row */
    .rpg-7 > *:nth-child(-n+4) figure,
    .rpg-9 *:nth-child(-n+10) figure,
    .rpg-11 > *:nth-child(-n+4) figure,
    .rpg-15 > *:nth-child(-n+4) figure
     {
        grid-column: span 4;
        grid-row: span 1;
    }
    /* four thumbnails in a row */
    .rpg-7 > *:nth-last-child(-n+4) figure,
    .rpg-11 > *:nth-last-child(-n+8) figure,
    /* .rpg-13 > *:nth-last-child(-n+4) figure, */
    .rpg-14 > *:nth-last-child(-n+4) figure,
    .rpg-15 > *:nth-child(n+5) figure,
    .rpg-20 > *:nth-last-child(-n+4) figure
     {
        grid-column: span 3;
        grid-row: span 1;
    }

    /* LAST row becomes 141 layout */
    .rpg-21 > *:nth-last-child(3) figure {
        grid-column: span 4;
        grid-row: span 2;
    }

    /* rpg-50 is "special" because it's the default perpage limit */
    .rpg-50 > *:nth-last-child(-n+10) figure {
        grid-column: span 2;
        grid-row: span 1;
    }
    .rpg-50 > *:nth-last-child(-n+4) figure {
        grid-column: span 3;
        grid-row: span 2;
    }

    /* FORCE 4 Photos per row */
    /* .rpg-12 prettier options become complicated css code */
    .rpg-12 > * figure {
        grid-column: span 3 !important;
        grid-row :span 1 !important;
    }
    /* SIX Photos per row (eg super-large galleries) */
    .r__gallery-thumbs > *:nth-child(n+52) figure {
        grid-column: span 2;
        grid-row: span 1;
    }
}

/* Only one image? Make it big, but not too BIG */
.rpg-1 figure {
    grid-column:2/-2 !important;
    aspect-ratio:auto;
}
.rpg-1 img {
    aspect-ratio: auto;
}
/* Force 3-per-row for `simple` gallery */
/* MUST BE LAST GALLERY RULE IN CSS */
.rpg-simple figure {
    grid-column: span 4 !important;
    grid-row: span 1 !important;
}

dialog {
    transition:
        display 0.4s allow-discrete,
        overlay 0.3s allow-discrete,
        opacity 0.3s,
        transform 0.2s;
    opacity: 0;
    transform:scale(0.3);
    
    &[open] {
        transform:scale(1);
        opacity: 1;
    }
}




/* used in the R_Photo class method */
.scp-thumbnail {
    max-height:200px;
}
.featured_image:hover figcaption {background: hsla(0,0%,100%,0.5);}



/* ==========================================================================================================
=========  =====  =======  ==    ==  =====  =====  =====        ==    ====    ====  =======  ===      =======
========    ====   ======  ===  ===   ===   ====    =======  ======  ====  ==  ===   ======  ==  ====  ======
=======  ==  ===    =====  ===  ===  =   =  ===  ==  ======  ======  ===  ====  ==    =====  ==  ====  ======
======  ====  ==  ==  ===  ===  ===  == ==  ==  ====  =====  ======  ===  ====  ==  ==  ===  ===  ===========
======  ====  ==  ===  ==  ===  ===  =====  ==  ====  =====  ======  ===  ====  ==  ===  ==  =====  =========
======        ==  ====  =  ===  ===  =====  ==        =====  ======  ===  ====  ==  ====  =  =======  =======
======  ====  ==  =====    ===  ===  =====  ==  ====  =====  ======  ===  ====  ==  =====    ==  ====  ======
======  ====  ==  ======   ===  ===  =====  ==  ====  =====  ======  ====  ==  ===  ======   ==  ====  ======
======  ====  ==  =======  ==    ==  =====  ==  ====  =====  =====    ====    ====  =======  ===      =======
========================================================================================================== */
/* 2024 NOV 14 : Put all animations behind no motion preference */
@media (prefers-reduced-motion: no-preference) {
    /* hover effect for thumbnails */
    .r__lightboxable:hover > img {
        scale:1.2;
        transition:scale 1s;
        border-radius:9px;
    }
    .rpg-1 .r__lightboxable:hover > img,
    .scf-inline.r__lightboxable:hover > img {
        scale:1.02;
        transition:scale 0.5s;
        border-radius:4px;
    }

}

/* BETA */ /* 2025 MAR 29 : disabled due to overreach onto ALL <figure><figcaptions> */
/* show caption on thumnail hover */
figure {position:relative;}
figure:hover {z-index:2}
/* *:not(dialog) > figure:not(.scp-diptych):hover > figcaption {
    opacity: 1;
    scale: 1.2;
    transition: opacity 2s, scale 1s;
}
*:not(dialog) > figure:hover > figcaption > time {
    display:none;
} */

/* SHOW MORE IMAGE */
.rfg-showmore {
    grid-column: span 2;
    background-position: center;
    background-size: cover;
    background-clip: content-box;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rfg-showmore > a {
    width: 100%;
    height: 100%;
    /* color: var(--color); */
    background: hsla(0,0%,100%,0.5);
    font-size: var(--rfs-5);
    display: grid;
    align-items: center;
    justify-content: center;
}
.rfg-showmore:hover > a {
    color: var(--gray);
    transition: color 1s;
}
@container r__gallery (width < 600px) {
    .rfg-showmore {
        grid-column: 2/-2;
        aspect-ratio: 2/1;
    }
    .rpg-8 .rfg-showmore {
        grid-column: span 4;
        grid-row: span 1;
    }
}
/* DATETIME TOOLTIP */
/* time {position:relative;} */
dialog time::after {
    content: attr(datetime);
    opacity: 0;
    position: absolute;
    /* width: max-content; */
    /* width: 100%;
    height: 100%;
    top: 0;
    left: 0; */
    text-align: center;
    background: silver;
    color: black;
    padding-inline: 4px;
    border-radius: 2px;
}
dialog time:hover::after {
    opacity:1;
    transition: opacity 0.5s;
}










/* START =^.^=ALPHA : 2024 JUL 06 : DeBug Testing*/
.pitufo > figcaption {background: var(--feldgrau-light);}
.train > figcaption {background: var(--col_train);}
.brarrow > figcaption {background: var(--col_brred);}
/* ENDOF =^.^=ALPHA : 2024 JUL 06 : DeBug Testing*/


/* 2024 JUL 06 */
/* .r__figure {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: space-between;
    margin: 10px auto;
    width: 100%;
    aspect-ratio: 4/5;
    outline: 1px solid gray;
}
.r__gallery > figure > img {max-width:200px;max-height:200px;}
.r__gallery > figure > figcaption {
    width:100%;
    font-size:var(--small);
    white-space:pre;
} */

