.cs-gallery {
    width: 100%;
}

.cs-gallery-grid,
.cs-gallery-manage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.cs-gallery-tile,
.cs-gallery-manage-item {
    min-width: 0;
}

.cs-gallery-image-button {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0 solid transparent;
    border-radius: var(--cs-radius-md, 12px);
    background: transparent !important;
    background-color: transparent !important;
    cursor: zoom-in;
    aspect-ratio: 1 / 1;
}

.cs-gallery-image-button img,
.cs-gallery-manage-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-gallery-image-button img {
    transition: transform .18s ease, opacity .18s ease;
}

.cs-gallery-image-button:hover img {
    transform: scale(1.025);
    opacity: .94;
}

.cs-gallery-tile__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .55rem;
    align-items: center;
    padding-top: .55rem;
}

.cs-gallery-tile__meta a {
    color: var(--cs-primary);
    font-weight: 700;
    text-decoration: none;
}

.cs-gallery-filters {
    display: grid;
    grid-template-columns: minmax(150px, .8fr) minmax(160px, 1fr) minmax(150px, .8fr) auto;
    gap: .65rem;
    margin-bottom: 1rem;
}

.cs-gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
    margin-top: 1.4rem;
}

.cs-gallery-pagination .page-numbers {
    display: inline-flex;
    min-width: 38px;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: .3rem .6rem;
    border: 1px solid var(--cs-border);
    border-radius: 8px;
    text-decoration: none;
}

.cs-gallery-pagination .current {
    background: var(--cs-primary);
    color: #fff;
    border-color: var(--cs-primary);
}

.cs-gallery-manage {
    margin-top: 1.5rem;
}

.cs-gallery-manage__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.cs-gallery-manage-item {
    position: relative;
    display: grid;
    gap: .45rem;
    padding: .55rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-md, 12px);
    background: var(--cs-surface);
}

.cs-gallery-manage-item img {
    aspect-ratio: 1 / 1;
    border-radius: calc(var(--cs-radius-md, 12px) - 4px);
}

.cs-gallery-manage-item__actions {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    align-items: center;
}

.cs-gallery-drag {
    cursor: grab;
    user-select: none;
    font-size: 1.2rem;
}

.cs-gallery-manage-item.is-dragging {
    opacity: .55;
}

.cs-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vw, 36px);
    background: rgba(0, 0, 0, .88);
}

.cs-gallery-lightbox.is-open {
    display: flex;
}

.cs-gallery-lightbox img {
    display: block;
    max-width: min(94vw, 1600px);
    max-height: 88vh;
    object-fit: contain;
}

.cs-gallery-lightbox__close {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 2;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2.2rem;
    cursor: pointer;
}

.cs-gallery-lightbox__caption {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    color: #fff;
}

@media (max-width: 900px) {
    .cs-gallery-grid,
    .cs-gallery-manage-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cs-gallery-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .cs-gallery-grid,
    .cs-gallery-manage-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .6rem;
    }

    .cs-gallery-filters {
        grid-template-columns: 1fr;
    }
}


.cs-gallery-image-button:focus-visible {
    outline: 2px solid var(--cs-primary, currentColor);
    outline-offset: 3px;
}


.cs-gallery-image-button:hover,
.cs-gallery-image-button:focus,
.cs-gallery-image-button:active {
    background-color: transparent !important;
}


/* v1.0.9: Pleasure-family card design for the public gallery */
.cs-gallery-public{
    --cs-gallery-card-bg:#0d1016;
    --cs-gallery-card-border:rgba(255,255,255,.08);
    --cs-gallery-card-hover-border:rgba(255,255,255,.16);
    --cs-gallery-card-radius:14px;
    --cs-gallery-media-ratio:125;
    --cs-gallery-badge-bg:rgba(5,6,9,.66);
    --cs-gallery-type-color:#fff;
    --cs-gallery-type-size:15px;
    --cs-gallery-city-bg:rgba(5,6,9,.66);
    --cs-gallery-city-color:#fff;
    --cs-gallery-footer-bg:rgba(10,12,17,.96);
    --cs-gallery-like-color:#ff1744;
    --cs-gallery-like-border:rgba(255,255,255,.14);
    --cs-gallery-like-bg:rgba(255,255,255,.025);
    --cs-gallery-like-hover-bg:rgba(255,255,255,.065);
}
.cs-gallery-public .cs-gallery-grid{
    align-items:start;
}
.cs-gallery-public .cs-gallery-tile{
    position:relative;
    overflow:hidden;
    min-width:0;
    border:1px solid var(--cs-gallery-card-border);
    border-radius:var(--cs-gallery-card-radius);
    background:var(--cs-gallery-card-bg);
    box-shadow:none;
    transition:border-color .16s ease,transform .16s ease;
}
.cs-gallery-public .cs-gallery-tile:hover{
    border-color:var(--cs-gallery-card-hover-border);
    transform:translateY(-2px);
}
.cs-gallery-public .cs-gallery-tile__media{
    position:relative;
    overflow:hidden;
    width:100%;
    aspect-ratio:100 / var(--cs-gallery-media-ratio);
    background:#080a0e;
}
.cs-gallery-public .cs-gallery-image-button{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    aspect-ratio:auto;
    border:0!important;
    border-radius:0!important;
    cursor:zoom-in;
}
.cs-gallery-public .cs-gallery-image-button img{
    width:100%;
    height:100%;
    border-radius:0!important;
    object-fit:cover;
}
.cs-gallery-public .cs-gallery-image-button:hover,
.cs-gallery-public .cs-gallery-image-button:focus,
.cs-gallery-public .cs-gallery-image-button:active{
    background:transparent!important;
    box-shadow:none!important;
}
.cs-gallery-public .cs-gallery-image-button:hover img{
    transform:scale(1.025);
}
.cs-gallery-city-badge,
.cs-gallery-type-badge{
    position:absolute;
    z-index:4;
    top:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(255,255,255,.14);
    background:var(--cs-gallery-badge-bg);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    box-shadow:0 5px 16px rgba(0,0,0,.22);
    pointer-events:none;
}
.cs-gallery-city-badge{
    left:8px;
    max-width:calc(100% - 54px);
    min-height:28px;
    padding:5px 9px;
    overflow:hidden;
    border-radius:999px;
    background:var(--cs-gallery-city-bg);
    color:var(--cs-gallery-city-color);
    font-size:10px;
    font-weight:750;
    line-height:1;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.cs-gallery-type-badge{
    right:8px;
    width:30px;
    height:30px;
    padding:6px;
    border-radius:9px;
    color:var(--cs-gallery-type-color);
}
.cs-gallery-type-badge i,
.cs-gallery-type-badge svg{
    display:block;
    width:var(--cs-gallery-type-size);
    height:var(--cs-gallery-type-size);
    font-size:var(--cs-gallery-type-size);
    line-height:1;
}
.cs-gallery-type-badge svg{
    fill:currentColor;
}
.cs-gallery-video-placeholder{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    color:rgba(255,255,255,.7);
    font-size:32px;
}
.cs-gallery-public .cs-gallery-tile__footer{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    min-height:44px;
    padding:8px 9px;
    background:var(--cs-gallery-footer-bg);
}
.cs-gallery-public .cs-gallery-tile__user{
    min-width:0;
    overflow:hidden;
    color:var(--cs-primary,#ff1744);
    font-size:11px;
    font-weight:750;
    line-height:1.2;
    text-decoration:none;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.cs-gallery-public .cs-gallery-tile__user:hover{
    text-decoration:underline;
}
.cs-gallery-public .cs-gallery-tile__like{
    flex:0 0 auto;
    margin-left:auto;
}
.cs-gallery-public .cs-social-gallery-like{
    margin:0!important;
}
.cs-gallery-public .cs-social-like{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    min-width:0!important;
    min-height:28px!important;
    height:28px!important;
    margin:0!important;
    padding:4px 8px!important;
    border:1px solid var(--cs-gallery-like-border)!important;
    border-radius:999px!important;
    background:var(--cs-gallery-like-bg)!important;
    color:var(--cs-gallery-like-color)!important;
    font-size:10px!important;
    font-weight:800!important;
    line-height:1!important;
    box-shadow:none!important;
    transition:background .15s ease,border-color .15s ease,transform .15s ease;
}
.cs-gallery-public .cs-social-like:hover,
.cs-gallery-public .cs-social-like:focus{
    background:var(--cs-gallery-like-hover-bg)!important;
    color:var(--cs-gallery-like-color)!important;
    transform:translateY(-1px);
}
.cs-gallery-public .cs-social-like:disabled{
    opacity:.55;
    transform:none;
}
.cs-gallery-public .cs-social-like span:first-child{
    color:var(--cs-gallery-like-color);
    font-size:13px;
}
.cs-gallery-public .cs-social-like span[data-like-count]{
    color:var(--cs-gallery-like-color);
}

/* Public-gallery lightbox can now render either image or video. */
.cs-gallery-lightbox video{
    display:block;
    max-width:min(94vw,1600px);
    max-height:88vh;
    object-fit:contain;
    background:#000;
}
@media(max-width:620px){
    .cs-gallery-city-badge{top:6px;left:6px;max-width:calc(100% - 46px);min-height:25px;padding:4px 7px;font-size:9px}
    .cs-gallery-type-badge{top:6px;right:6px;width:27px;height:27px;padding:5px;border-radius:8px}
    .cs-gallery-public .cs-gallery-tile__footer{min-height:40px;padding:7px}
    .cs-gallery-public .cs-gallery-tile__user{font-size:10px}
    .cs-gallery-public .cs-social-like{height:26px!important;min-height:26px!important;padding:3px 7px!important}
}


/* v1.0.10: full-bleed public gallery card with Virtual Date style bottom gradient */
.cs-gallery-public{
    --cs-gallery-card-bg:#0d1016;
    --cs-gallery-card-border:rgba(255,255,255,.08);
    --cs-gallery-card-hover-border:rgba(255,255,255,.18);
    --cs-gallery-card-radius:14px;
    --cs-gallery-media-ratio:125;
    --cs-gallery-gradient-bottom:rgba(0,0,0,.92);
    --cs-gallery-gradient-mid:rgba(0,0,0,.48);
    --cs-gallery-gradient-top:rgba(0,0,0,0);
    --cs-gallery-gradient-height:58%;
    --cs-gallery-footer-bg:transparent;
    --cs-gallery-footer-padding-x:10px;
    --cs-gallery-footer-padding-y:9px;
    --cs-gallery-username-color:var(--cs-primary,#ff1744);
    --cs-gallery-username-hover-color:#fff;
    --cs-gallery-card-hover-y:-2px;
    --cs-gallery-hover-duration:.18s;
    --cs-gallery-image-hover-scale:1.03;
    --cs-gallery-image-hover-opacity:.96;
    --cs-gallery-hover-overlay:rgba(0,0,0,0);
}
.cs-gallery-public .cs-gallery-tile{
    background:var(--cs-gallery-card-bg);
    transition:border-color var(--cs-gallery-hover-duration) ease,transform var(--cs-gallery-hover-duration) ease,box-shadow var(--cs-gallery-hover-duration) ease;
}
.cs-gallery-public .cs-gallery-tile:hover{
    border-color:var(--cs-gallery-card-hover-border);
    transform:translateY(var(--cs-gallery-card-hover-y));
}
.cs-gallery-public .cs-gallery-tile__media{
    isolation:isolate;
    border-radius:calc(var(--cs-gallery-card-radius) - 1px);
}
.cs-gallery-public .cs-gallery-tile__media::before{
    content:"";
    position:absolute;
    inset:0;
    z-index:2;
    pointer-events:none;
    background:var(--cs-gallery-hover-overlay);
    opacity:0;
    transition:opacity var(--cs-gallery-hover-duration) ease;
}
.cs-gallery-public .cs-gallery-tile:hover .cs-gallery-tile__media::before{
    opacity:1;
}
.cs-gallery-public .cs-gallery-tile__media::after{
    content:"";
    position:absolute;
    z-index:3;
    left:0;
    right:0;
    bottom:0;
    height:var(--cs-gallery-gradient-height);
    pointer-events:none;
    background:linear-gradient(to top,var(--cs-gallery-gradient-bottom) 0%,var(--cs-gallery-gradient-mid) 48%,var(--cs-gallery-gradient-top) 100%);
}
.cs-gallery-public .cs-gallery-image-button{
    z-index:1;
}
.cs-gallery-public .cs-gallery-image-button img{
    transition:transform var(--cs-gallery-hover-duration) ease,opacity var(--cs-gallery-hover-duration) ease;
}
.cs-gallery-public .cs-gallery-tile:hover .cs-gallery-image-button img{
    transform:scale(var(--cs-gallery-image-hover-scale));
    opacity:var(--cs-gallery-image-hover-opacity);
}
.cs-gallery-public .cs-gallery-city-badge,
.cs-gallery-public .cs-gallery-type-badge{
    z-index:5;
}
.cs-gallery-public .cs-gallery-tile__footer{
    position:absolute;
    z-index:6;
    left:0;
    right:0;
    bottom:0;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    min-height:44px;
    padding:var(--cs-gallery-footer-padding-y) var(--cs-gallery-footer-padding-x);
    background:var(--cs-gallery-footer-bg);
    pointer-events:none;
}
.cs-gallery-public .cs-gallery-tile__footer > *{
    pointer-events:auto;
}
.cs-gallery-public .cs-gallery-tile__user{
    color:var(--cs-gallery-username-color);
    text-shadow:0 1px 4px rgba(0,0,0,.75);
}
.cs-gallery-public .cs-gallery-tile__user:hover{
    color:var(--cs-gallery-username-hover-color);
}
.cs-gallery-public .cs-social-like{
    backdrop-filter:blur(7px);
    -webkit-backdrop-filter:blur(7px);
}
@media(max-width:620px){
    .cs-gallery-public{--cs-gallery-gradient-height:64%;--cs-gallery-footer-padding-x:7px;--cs-gallery-footer-padding-y:7px}
}


/* v1.0.11: true full-bleed card.
   The card itself owns the aspect ratio and the media layer is pinned to every edge.
   This guarantees that the photo continues underneath the gradient/footer. */
.cs-gallery-public .cs-gallery-tile{
    aspect-ratio:100 / var(--cs-gallery-media-ratio);
}
.cs-gallery-public .cs-gallery-tile__media{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    aspect-ratio:auto;
    border-radius:0;
    background:transparent;
}
.cs-gallery-public .cs-gallery-image-button{
    position:absolute;
    inset:0;
    display:block;
    width:100%;
    height:100%;
    min-width:100%;
    min-height:100%;
    padding:0!important;
    margin:0!important;
}
.cs-gallery-public .cs-gallery-image-button img{
    position:absolute;
    inset:0;
    display:block;
    width:100%!important;
    height:100%!important;
    min-width:100%!important;
    min-height:100%!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    object-fit:cover!important;
    object-position:center center;
}


/* v1.0.12: make all public gallery filter fields visually consistent.
   Selects now keep the same visible border/background as the location input,
   while Elementor can still override color, background, border color and radius. */
.cs-gallery-public .cs-gallery-filters .cs-input,
.cs-gallery-public .cs-gallery-filters .cs-select{
    box-sizing:border-box;
    width:100%;
    min-height:42px;
    margin:0;
    padding:8px 12px;
    border-width:1px;
    border-style:solid;
    border-color:rgba(255,255,255,.18);
    border-radius:4px;
    background-color:transparent;
    color:inherit;
    box-shadow:none;
    outline:none;
    font:inherit;
    line-height:1.25;
}
.cs-gallery-public .cs-gallery-filters .cs-select{
    cursor:pointer;
}
.cs-gallery-public .cs-gallery-filters .cs-input:hover,
.cs-gallery-public .cs-gallery-filters .cs-select:hover{
    border-color:rgba(255,255,255,.30);
}
.cs-gallery-public .cs-gallery-filters .cs-input:focus,
.cs-gallery-public .cs-gallery-filters .cs-select:focus{
    border-color:var(--cs-primary,#ff1744);
    box-shadow:0 0 0 1px var(--cs-primary,#ff1744);
}

/* Moderation / image reporting */
.cs-gallery-tile__report{display:flex;justify-content:flex-end;padding:.35rem .15rem 0}
.cs-gallery-report-button{appearance:none;border:0;background:transparent;padding:.25rem .4rem;color:inherit;opacity:.68;font:inherit;font-size:.82rem;cursor:pointer}
.cs-gallery-report-button:hover,.cs-gallery-report-button:focus-visible{opacity:1;text-decoration:underline}
.cs-gallery-report-modal{position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(0,0,0,.72)}
.cs-gallery-report-modal__card{width:min(460px,100%);border-radius:16px;padding:20px;background:#111;color:#fff;box-shadow:0 24px 80px rgba(0,0,0,.55)}
.cs-gallery-report-modal__card h3{margin:0 0 16px}
.cs-gallery-report-modal__card label{display:block;margin:12px 0 6px;font-weight:600}
.cs-gallery-report-modal__card select,.cs-gallery-report-modal__card textarea{box-sizing:border-box;width:100%;border:1px solid rgba(255,255,255,.18);border-radius:10px;background:#1d1d1d;color:#fff;padding:10px 12px;font:inherit}
.cs-gallery-report-modal__actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
.cs-gallery-moderation-notice{margin:12px 0;padding:10px 12px;border-radius:10px;background:rgba(255,255,255,.06);color:#ff3b5c;font-size:.92rem;font-weight:600}

/* v1.2.0: käyttäjäpopup ja Moderation 2.0 -karanteeni */
.cs-gallery-user-trigger{
    appearance:none!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    padding:0!important;
    margin:0!important;
    cursor:pointer;
    font:inherit;
    text-align:left;
}
.cs-gallery-user-modal{position:fixed;inset:0;z-index:100001;display:flex;align-items:center;justify-content:center;padding:20px}
.cs-gallery-user-modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72)}
.cs-gallery-user-modal__card{position:relative;z-index:1;width:min(420px,100%);border:1px solid rgba(255,255,255,.12);border-radius:14px;padding:18px;background:#0d1016;color:#fff;box-shadow:0 24px 80px rgba(0,0,0,.58)}
.cs-gallery-user-modal__card h2{margin:0 0 14px;color:#fff;font-size:1.35rem}
.cs-gallery-user-modal__actions{display:grid;gap:8px}
.cs-gallery-user-modal__actions .cs-button{width:100%;justify-content:center}

.cs-gallery-manage-item.is-quarantined{position:relative;cursor:default}
.cs-gallery-manage-item.is-quarantined img{filter:grayscale(1) brightness(.42);opacity:.58}
.cs-gallery-quarantine-overlay{position:absolute;inset:0;z-index:3;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:12px;text-align:center;background:rgba(0,0,0,.28);color:#fff;pointer-events:none}
.cs-gallery-quarantine-overlay strong{font-size:.9rem;text-transform:uppercase;letter-spacing:.04em;color:#ff3b5c}
.cs-gallery-quarantine-overlay span{font-size:.72rem;color:rgba(255,255,255,.82)}


/* v1.2.1: Ads gallery_feed placement */
.cs-gallery-feed-ad{
    grid-column:1 / -1;
    width:100%;
    min-width:0;
    margin:.15rem 0;
}
.cs-gallery-feed-ad > *{
    width:100%;
    max-width:100%;
}
