/* Every rule is scoped to the homepage gallery. Other sections retain their styles. */
#gallery.sg-home-gallery {
    padding: 62px 0 54px;
    background: #f2f2f2;
    border-block: 1px solid #e6e7e9;
    scroll-margin-top: 95px;
}
#gallery.sg-home-gallery .sg-gallery-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 30px; margin-bottom: 30px;
}
#gallery.sg-home-gallery .sg-eyebrow {
    margin: 0 0 12px; color: #d81324; font-size: 12px;
    font-weight: 500; line-height: 1.5; letter-spacing: .09em; text-transform: uppercase;
}
#gallery.sg-home-gallery .sg-gallery-header h2 {
    color: #0b2154; font-family: Barlow, Arial, sans-serif;
    font-size: clamp(32px, 3vw, 42px); font-weight: 700;
    line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px;
}
#gallery.sg-home-gallery .sg-gallery-intro {
    color: #596575; font-size: 15px; line-height: 1.7; margin: 0;
}
#gallery.sg-home-gallery .sg-all-link {
    display: inline-flex; justify-content: center; align-items: center;
    gap: 12px; flex-shrink: 0; min-height: 48px; padding: 12px 20px;
    color: #0b2154; background: #fff; border: 1px solid #c6cdd8;
    border-radius: 3px; font-size: 13px; font-weight: 500;
    text-decoration: none; transition: color .2s, background-color .2s, border-color .2s;
}
#gallery.sg-home-gallery .sg-all-link:hover {
    color: #fff; background: #d81324; border-color: #d81324;
}
#gallery.sg-home-gallery svg {
    width: 20px; height: 20px; flex-shrink: 0;
    stroke: currentColor; fill: none; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
}
#gallery.sg-home-gallery .sg-photo-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 22px;
}
#gallery.sg-home-gallery .sg-photo {
    display: block; min-width: 0; padding: 7px 7px 0;
    color: #0b2154; background: #fff; border: 1px solid #e0e4e9;
    border-radius: 4px; text-decoration: none;
    box-shadow: 0 3px 12px rgb(11 33 84 / 4%);
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
#gallery.sg-home-gallery .sg-photo img {
    display: block; width: 100%; height: 190px; aspect-ratio: auto;
    object-fit: contain; border-radius: 2px; background: #fff;
}
#gallery.sg-home-gallery .sg-photo:hover {
    border-color: #d81324; box-shadow: 0 8px 22px rgb(11 33 84 / 9%); transform: translateY(-2px);
}
#gallery.sg-home-gallery .sg-gallery-pager {
    display: flex; justify-content: space-between; align-items: center;
    gap: 20px; margin-top: 26px; padding-top: 22px; border-top: 1px solid #d9dfe6;
}
#gallery.sg-home-gallery .sg-gallery-status {
    color: #596575; font-size: 12px; line-height: 1.5; margin: 0; font-variant-numeric: tabular-nums;
}
#gallery.sg-home-gallery .sg-page-actions { display: flex; align-items: center; gap: 13px; }
#gallery.sg-home-gallery .sg-control {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 44px; padding: 10px 15px; color: #0b2154; background: #fff;
    border: 1px solid #c6cdd8; border-radius: 3px; font: inherit;
    font-size: 12px; font-weight: 500; line-height: 1.4;
    cursor: pointer; transition: color .2s, background-color .2s, border-color .2s;
}
#gallery.sg-home-gallery .sg-control:hover:not(:disabled):not([aria-disabled="true"]) {
    color: #fff; background: #d81324; border-color: #d81324;
}
#gallery.sg-home-gallery .sg-control:disabled,
#gallery.sg-home-gallery .sg-control[aria-disabled="true"] { opacity: .45; cursor: default; }
#gallery.sg-home-gallery .sg-page-number { min-width: 42px; color: #0b2154; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
#gallery.sg-home-gallery [hidden] { display: none !important; }
#gallery.sg-home-gallery :focus-visible { outline: 3px solid #8f0d19; outline-offset: 4px; }

/* The image viewer belongs to this section and uses the browser's modal focus handling. */
#gallery.sg-home-gallery .sg-lightbox {
    width: min(1080px, calc(100vw - 40px)); max-width: none;
    max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
    margin: auto; padding: 0; color: #263348; background: #fff;
    border: 0; border-radius: 5px; box-shadow: 0 20px 70px rgb(0 0 0 / 24%);
    overflow: auto; overscroll-behavior: contain;
}
#gallery.sg-home-gallery .sg-lightbox:not([open]) { display: none; }
#gallery.sg-home-gallery .sg-lightbox[open] { display: flex; flex-direction: column; }
#gallery.sg-home-gallery .sg-lightbox::backdrop { background: rgb(4 14 36 / 84%); }
#gallery.sg-home-gallery .sg-lightbox-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 16px 22px; border-bottom: 1px solid #e1e5eb; flex-shrink: 0;
    position: sticky; top: 0; z-index: 2; background: #fff;
}
#gallery.sg-home-gallery .sg-lightbox-header h3 {
    margin: 0 0 3px; color: #0b2154; font: 600 20px/1.3 Barlow, Arial, sans-serif;
}
#gallery.sg-home-gallery .sg-lightbox-header p { margin: 0; color: #596575; font-size: 11px; }
#gallery.sg-home-gallery .sg-close { width: 44px; padding: 10px; flex-shrink: 0; }
#gallery.sg-home-gallery .sg-lightbox-figure { margin: 0; min-height: 0; flex: 0 0 auto; }
#gallery.sg-home-gallery .sg-lightbox-image-wrap {
    display: flex; align-items: center; justify-content: center; background: #f7f8fa; padding: 16px;
}
#gallery.sg-home-gallery .sg-lightbox-image-wrap img {
    display: block; width: auto; height: auto; max-width: 100%;
    max-height: calc(100vh - 245px); max-height: calc(100dvh - 245px);
    object-fit: contain;
}
#gallery.sg-home-gallery .sg-lightbox-controls {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 22px 20px; flex-shrink: 0;
}

@media (max-width: 991.98px) {
    #gallery.sg-home-gallery .sg-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    #gallery.sg-home-gallery:not(.sg-ready) .sg-photo:nth-child(n+5) { display: none; }
}
@media (max-width: 767.98px) {
    #gallery.sg-home-gallery { padding: 45px 0; }
    #gallery.sg-home-gallery .sg-gallery-header { align-items: flex-start; flex-direction: column; gap: 20px; }
    #gallery.sg-home-gallery .sg-gallery-header h2 { font-size: 34px; }
    #gallery.sg-home-gallery .sg-gallery-intro { font-size: 14px; }
    #gallery.sg-home-gallery .sg-gallery-pager { gap: 16px; flex-wrap: wrap; }
    #gallery.sg-home-gallery .sg-page-actions { gap: 9px; }
}
@media (max-width: 575.98px) {
    #gallery.sg-home-gallery .sg-photo-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    #gallery.sg-home-gallery:not(.sg-ready) .sg-photo:nth-child(n+3) { display: none; }
    #gallery.sg-home-gallery .sg-gallery-header { margin-bottom: 24px; }
    #gallery.sg-home-gallery .sg-gallery-header h2 { font-size: 31px; }
    #gallery.sg-home-gallery .sg-gallery-pager { flex-direction: column; align-items: stretch; }
    #gallery.sg-home-gallery .sg-gallery-status { text-align: center; }
    #gallery.sg-home-gallery .sg-page-actions { justify-content: center; }
    #gallery.sg-home-gallery .sg-control { padding-inline: 13px; }
    #gallery.sg-home-gallery .sg-lightbox { width: calc(100vw - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
    #gallery.sg-home-gallery .sg-lightbox-header { padding: 12px 14px; }
    #gallery.sg-home-gallery .sg-lightbox-image-wrap { padding: 8px; }
    #gallery.sg-home-gallery .sg-lightbox-image-wrap img { max-height: calc(100vh - 240px); max-height: calc(100dvh - 240px); }
        #gallery.sg-home-gallery .sg-lightbox-controls { padding: 14px; gap: 10px; }
    #gallery.sg-home-gallery .sg-lightbox-controls .sg-control { font-size: 11px; gap: 7px; }
}
@media (max-height: 500px) {
    #gallery.sg-home-gallery .sg-lightbox-image-wrap img { max-height: none; max-width: min(100%, 650px); }
}
@media (prefers-reduced-motion: reduce) {
    #gallery.sg-home-gallery *, #gallery.sg-home-gallery *::before, #gallery.sg-home-gallery *::after {
        animation: none !important; transition: none !important; scroll-behavior: auto !important;
    }
    #gallery.sg-home-gallery .sg-photo:hover { transform: none; }
}

/* Gallery-only refinement: preserve the approved layout without visible captions or empty final-page slots. */
#gallery.sg-home-gallery .sg-photo { padding: 7px; }
#gallery.sg-home-gallery .sg-photo-footer,
#gallery.sg-home-gallery figcaption[data-gallery-description] { display: none !important; }
#gallery.sg-home-gallery .sg-photo-grid.sg-partial-page {
  grid-template-columns: repeat(var(--sg-visible-columns, 1), minmax(0, 1fr));
  justify-content: center; margin-inline: auto;
}
#gallery.sg-home-gallery .sg-photo-grid.sg-partial-page[data-visible-count="1"] { max-width: 360px; }
#gallery.sg-home-gallery .sg-photo-grid.sg-partial-page[data-visible-count="2"] { max-width: 742px; }
@media (max-width: 575.98px) {
  #gallery.sg-home-gallery .sg-photo-grid.sg-partial-page { max-width: none !important; }
}

/* Final gallery tile refinement: image fills the complete tile edge-to-edge. */
#gallery.sg-home-gallery .sg-photo {
    padding: 0 !important;
    height: 280px;
    overflow: hidden;
    background: #fff;
}
#gallery.sg-home-gallery .sg-photo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center;
    border-radius: 3px;
    background: transparent;
}
@media (max-width: 991.98px) {
    #gallery.sg-home-gallery .sg-photo { height: 250px; }
}
@media (max-width: 575.98px) {
    #gallery.sg-home-gallery .sg-photo { height: 260px; }
}

/* Gallery visual polish: light-grey themed section with full-bleed image tiles. */
#gallery.sg-home-gallery {
    padding: 72px 0 62px;
    background: #f4f5f7;
    border-block: 1px solid #e4e7ec;
}
#gallery.sg-home-gallery .container {
    position: relative;
}
#gallery.sg-home-gallery .sg-gallery-header {
    position: relative;
    margin-bottom: 34px;
    padding: 0 0 24px;
    border-bottom: 1px solid #d9dee6;
}
#gallery.sg-home-gallery .sg-gallery-header::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 92px;
    height: 3px;
    background: #d81324;
}
#gallery.sg-home-gallery .sg-eyebrow {
    margin-bottom: 9px;
    color: #d81324;
    font-weight: 700;
    letter-spacing: .13em;
}
#gallery.sg-home-gallery .sg-gallery-header h2 {
    margin-bottom: 8px;
    color: #0b2154;
}
#gallery.sg-home-gallery .sg-gallery-intro {
    color: #667085;
}
#gallery.sg-home-gallery .sg-all-link {
    border-radius: 7px;
    border-color: #d3d9e2;
    box-shadow: 0 2px 8px rgb(11 33 84 / 4%);
}
#gallery.sg-home-gallery .sg-photo-grid {
    gap: 18px;
}
#gallery.sg-home-gallery .sg-photo {
    height: 292px;
    border: 0;
    border-radius: 9px;
    box-shadow: 0 6px 18px rgb(11 33 84 / 8%);
}
#gallery.sg-home-gallery .sg-photo img {
    border-radius: inherit;
}
#gallery.sg-home-gallery .sg-photo:hover {
    border-color: transparent;
    box-shadow: 0 12px 28px rgb(11 33 84 / 14%);
    transform: translateY(-3px);
}
#gallery.sg-home-gallery .sg-gallery-pager {
    margin-top: 30px;
    padding-top: 24px;
    border-top-color: #d9dee6;
}
#gallery.sg-home-gallery .sg-control {
    border-radius: 7px;
    border-color: #d3d9e2;
    box-shadow: 0 2px 8px rgb(11 33 84 / 4%);
}
#gallery.sg-home-gallery .sg-page-number {
    font-weight: 600;
    color: #0b2154;
}
@media (max-width: 991.98px) {
    #gallery.sg-home-gallery .sg-photo { height: 260px; }
}
@media (max-width: 575.98px) {
    #gallery.sg-home-gallery { padding: 52px 0; }
    #gallery.sg-home-gallery .sg-photo { height: 270px; }
    #gallery.sg-home-gallery .sg-gallery-header { padding-bottom: 20px; }
}
