/* Full-width galleries site-wide - desktop only */
@media (min-width: 768px) {
    .wp-block-jetpack-tiled-gallery,
    .wp-block-gallery {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: calc((1170px - 100vw) / 2) !important;
        margin-right: 0 !important;
    }
}
@media (min-width: 768px) and (max-width: 1170px) {
    .wp-block-jetpack-tiled-gallery,
    .wp-block-gallery {
        margin-left: 0 !important;
    }
}

/* Mobile: full width but no negative margin */
@media (max-width: 767px) {
    .wp-block-jetpack-tiled-gallery,
    .wp-block-gallery {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
.wp-block-jetpack-tiled-gallery .tiled-gallery__row {
    margin-bottom: 4px !important;
    display: flex !important;
    flex-direction: row !important;
}
.wp-block-jetpack-tiled-gallery .tiled-gallery__col {
    margin-right: 4px !important;
    overflow: hidden !important;
}
.wp-block-jetpack-tiled-gallery .tiled-gallery__col:last-child {
    margin-right: 0 !important;
}

/* Fix: override theme's height:auto which breaks tiled columns layout */
.wp-block-jetpack-tiled-gallery .tiled-gallery__item img,
.wp-block-jetpack-tiled-gallery .tiled-gallery__item > a > img,
.wp-block-jetpack-tiled-gallery .tiled-gallery__item > img,
.entry-content .wp-block-jetpack-tiled-gallery .tiled-gallery__item img {
    object-fit: cover !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
}

/* Reduce header height to fit content only */
.top-header {
    min-height: 0 !important;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

/* Remove whitespace between nav and gallery */
#content {
    padding-top: 0 !important;
}

/* Hide page title (e.g. "Home", "Lifestyle") above galleries */
.hentry h2.entry-title,
.hentry h1.entry-title,
.page-title {
    display: none !important;
}

/* Slider title/text overlay re-enabled, positioned over the tint */

/* Disable carousel hover states */
a.slider-prev:hover,
a.slider-next:hover {
    opacity: 1 !important;
    transition: none !important;
}
nav.slider-button a.active,
nav.slider-button a:hover {
    background-color: transparent !important;
    transition: none !important;
}
.image-slider:hover {
    cursor: default !important;
}

/* Fix Events page: force equal columns when Jetpack JS fails to set flex-basis */
.events-page-template .wp-block-jetpack-tiled-gallery .tiled-gallery__col,
.page-id-488 .wp-block-jetpack-tiled-gallery .tiled-gallery__col {
    flex: 1 1 0% !important;
}

/* Hide top branding area, fix nav to top */
.top-header {
    display: none !important;
}
#sticky_header-sticky-wrapper,
#sticky_header {
    position: fixed !important;
    top: 32px !important; /* 32px accounts for WP admin bar when logged in */
    left: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
}
/* Push masthead content below fixed nav */
#masthead {
    padding-top: 51px !important;
    height: auto !important;
    min-height: auto !important;
}
/* For logged-out visitors, nav sits at very top */
body:not(.logged-in) #sticky_header-sticky-wrapper,
body:not(.logged-in) #sticky_header {
    top: 0 !important;
}

@media (min-width: 768px) {
/* --- Homepage slider: transparent diagonal overlay (pic-time style) --- */
.main-slider .image-slider {
    position: relative;
}
.main-slider .image-slider::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 25, 0.4);
    clip-path: polygon(0 0, 40% 0, 40% 100%, 0 100%);
    z-index: 1;
    pointer-events: none;
}
.main-slider .image-slider .container {
    position: relative;
    z-index: 2;
}

/* Position slider caption within the tinted overlay area */
.main-slider .slider-content {
    width: 40%;
    left: 0;
    top: 22% !important;
    text-align: left;
    box-sizing: border-box;
    padding-left: 48px;
    padding-right: 24px;
}
.main-slider .slider-title,
.main-slider .slider-title a,
.main-slider .slider-text,
.main-slider .slider-text h3 {
    color: #ffffff !important;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

/* Every slide heading: "IQT PHOTOS", styled to match the pic-time reference font */
.main-slider .layer-slider > .slides .slider-title a::before {
    content: "IQT PHOTOS";
}
.main-slider .layer-slider > .slides .slider-title,
.main-slider .layer-slider > .slides .slider-title a {
    font-family: 'futura-pt', Futura, 'Century Gothic', sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0.26em;
    text-transform: uppercase;
}

/* Every slide subtext: fixed caption, over the overlay (attached to the title element, which always exists) */
.main-slider .layer-slider > .slides .slider-text h3 {
    font-size: 0;
    line-height: 0;
}
.main-slider .layer-slider > .slides .slider-title::after {
    content: "Capturing life's most memorable moments";
    display: block;
    font-size: 16px;
    line-height: 24px;
    font-weight: 300;
    letter-spacing: normal;
    text-transform: none;
    font-family: "Open Sans", sans-serif;
    color: #ffffff;
    margin-top: 8px;
}

/* Let the slider caption reach the true left edge of the image (remove the centered max-width container inset) */
.main-slider .image-slider .container {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}
}

/* Hide filenames in Jetpack Carousel gallery lightbox */
.jp-carousel-photo-title-container,
.jp-carousel-caption {
    display: none !important;
}

/* Mobile: simplify tiled gallery to a clean 2-column grid instead of many tiny slivers */
@media (max-width: 767px) {
    .wp-block-jetpack-tiled-gallery .tiled-gallery__gallery {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    .wp-block-jetpack-tiled-gallery .tiled-gallery__row,
    .wp-block-jetpack-tiled-gallery .tiled-gallery__col {
        display: contents !important;
    }
    .wp-block-jetpack-tiled-gallery .tiled-gallery__item {
        flex: 0 0 calc(50% - 2px) !important;
        max-width: calc(50% - 2px) !important;
        margin: 0 !important;
    }
    #content .wp-block-jetpack-tiled-gallery .tiled-gallery__item img {
        width: 100% !important;
        height: auto !important;
        object-fit: unset !important;
        max-width: none !important;
    }
}

/* Tablet / iPad range: cap the tiled gallery to a sane column count instead of Jetpack's
   desktop-computed ~7 justified columns, which get clipped at the right edge when the
   full-width breakout above stretches the row to an iPad-width viewport */
@media (min-width: 768px) and (max-width: 1366px) {
    .wp-block-jetpack-tiled-gallery .tiled-gallery__gallery {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    .wp-block-jetpack-tiled-gallery .tiled-gallery__row,
    .wp-block-jetpack-tiled-gallery .tiled-gallery__col {
        display: contents !important;
    }
    #content .wp-block-jetpack-tiled-gallery .tiled-gallery__item img {
        width: 100% !important;
        height: auto !important;
        object-fit: unset !important;
        max-width: none !important;
    }
}

/* iOS WebKit renders background-attachment:fixed incorrectly (zooms into a tiny
   crop of the image instead of showing it in full) -- disable below desktop widths */
@media (max-width: 1366px) {
    .main-slider .image-slider {
        background-attachment: scroll !important;
    }
}
/* Extra safety margin on the tablet column grid so rounding at odd iPad widths
   (e.g. 1194px, 1366px) can't push a column past the edge */
@media (min-width: 768px) and (max-width: 1023px) {
    .wp-block-jetpack-tiled-gallery .tiled-gallery__item {
        flex: 0 0 calc(32% - 4px) !important;
        max-width: calc(32% - 4px) !important;
    }
}
@media (min-width: 1024px) and (max-width: 1366px) {
    .wp-block-jetpack-tiled-gallery .tiled-gallery__item {
        flex: 0 0 calc(24% - 4px) !important;
        max-width: calc(24% - 4px) !important;
    }
}

/* Tablet gallery alignment: empirically-tuned left shift to correct the
   full-width breakout on real iPad hardware, where the landscape and portrait
   viewport widths need different offsets */
@media (min-width: 1024px) and (max-width: 1366px) {
    .wp-block-jetpack-tiled-gallery,
    .wp-block-gallery {
        margin-left: -100px !important;
    }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .wp-block-jetpack-tiled-gallery,
    .wp-block-gallery {
        margin-left: -35px !important;
    }
}
