/* Pinterest-style photo wall, using the portfolio's existing theme. */
.project-gallery-section { padding: 80px 0; scroll-margin-top: 88px; border-top: 1px solid var(--border-color); }
.gallery-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.gallery-eyebrow { color: var(--ros-blue); font: 14px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
.gallery-heading h2 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.12; letter-spacing: -.04em; margin-bottom: 14px; }
.gallery-intro { color: var(--text-secondary); max-width: 530px; }
.gallery-count { color: var(--text-muted); font: 14px var(--font-mono); white-space: nowrap; padding-bottom: 4px; }
.gallery-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.gallery-filter { border: 1px solid var(--border-color); border-radius: 999px; background: transparent; color: var(--text-secondary); padding: 9px 17px; font: 500 13px var(--font-sans); cursor: pointer; }
.gallery-filter[aria-pressed="true"] { background: var(--ros-blue); border-color: var(--ros-blue); color: var(--primary-black); }
.gallery-filter:hover { border-color: var(--ros-blue); }
.gallery-grid { columns: 4; column-gap: 16px; }
.gallery-tile { width: 100%; display: block; position: relative; break-inside: avoid; margin-bottom: 16px; aspect-ratio: var(--tile-ratio); overflow: hidden; isolation: isolate; background: var(--card-bg); border: 1px solid #ffffff12; border-radius: 16px; cursor: zoom-in; text-align: left; color: white; }
.gallery-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.gallery-tile:hover img { transform: scale(1.045); }
.gallery-tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(0,0,0,.85)); pointer-events: none; }
.gallery-caption { position: absolute; bottom: 0; left: 0; right: 0; z-index: 1; padding: 18px; }
.gallery-category { display: block; color: #b9e7ff; font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 5px; }
.gallery-photo-title { display: block; font: 500 14px/1.35 var(--font-sans); text-wrap: balance; }
.gallery-expand { position: absolute; top: 12px; right: 12px; z-index: 1; display: grid; place-items: center; border: 1px solid #ffffff45; border-radius: 50%; width: 30px; height: 30px; color: white; background: #0e111780; font-size: 20px; }
.gallery-image-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font: 12px var(--font-mono); }
.gallery-image-fallback[hidden], .gallery-tile img[hidden], .gallery-viewer img[hidden], .gallery-viewer [hidden] { display: none; }
.gallery-tile:focus-visible, .gallery-filter:focus-visible, .gallery-viewer button:focus-visible { outline: 3px solid var(--ros-blue); outline-offset: 4px; }
.gallery-viewer { margin: auto; width: min(1100px, 94vw); max-width: 94vw; max-height: 94dvh; padding: 0; border: 1px solid var(--border-color); border-radius: 18px; background: var(--primary-black); color: white; overflow: auto; }
.gallery-viewer::backdrop { background: rgba(0,0,0,.88); backdrop-filter: blur(8px); }
.gallery-viewer-inner { padding: 20px; }
.gallery-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.gallery-viewer-toolbar h2 { font: 500 17px/1.4 var(--font-sans); }
.gallery-viewer button { flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--card-bg); color: white; cursor: pointer; font: 20px var(--font-sans); }
.gallery-viewer button:disabled { opacity: .4; cursor: default; }
.gallery-viewer-stage { display: flex; align-items: center; justify-content: center; min-height: 150px; }
.gallery-viewer-stage img, .gallery-viewer-stage video { display: block; max-width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 6px; }
.gallery-viewer-bottom { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 16px; }
.gallery-viewer-position { color: var(--text-secondary); font: 14px var(--font-mono); min-width: 65px; text-align: center; }
@media (min-width: 769px) and (max-width: 1100px) { .nav-menu { gap: .85rem; } .nav-social { gap: .3rem; margin-left: .7rem; } }
@media (max-width: 1000px) { .gallery-grid { columns: 3; } }
@media (max-width: 700px) { .gallery-grid { columns: 2; column-gap: 12px; } .gallery-tile { margin-bottom: 12px; border-radius: 12px; } .gallery-caption { padding: 12px; } .gallery-photo-title { font-size: 12px; } .gallery-category { font-size: 9px; } .gallery-heading { align-items: start; } .gallery-count { padding-top: 8px; } .project-gallery-section { padding: 55px 0; } .gallery-filter { padding: 8px 13px; } .gallery-viewer-inner { padding: 12px; } }
@media (max-width: 380px) { .gallery-grid { column-gap: 8px; } .gallery-caption { padding: 10px; } .gallery-category { letter-spacing: .03em; } .gallery-heading { display: block; } .gallery-count { display: block; margin-top: 12px; } }
@media (prefers-reduced-motion: reduce) { .gallery-tile img { transition: none; } }

/* Videos use lightweight poster images; only the selected video is loaded. */
.gallery-tile-video { cursor: pointer; }
.gallery-tile-video .gallery-expand { background: #0e1117cc; font-size: 13px; }
.gallery-viewer-stage video { width: 100%; background: #000; }
@media (max-width: 700px) { .gallery-heading { flex-wrap: wrap; } .gallery-count { padding-top: 0; } }

/* Keep each project's media together across every screen size. */
.gallery-groups { display: grid; gap: 40px; }
.gallery-project-group { padding: 0; }
.gallery-project-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.gallery-project-heading { font: 500 clamp(18px, 2vw, 23px)/1.3 var(--font-sans); letter-spacing: -.02em; }
.gallery-project-total { color: var(--text-muted); font: 12px var(--font-mono); white-space: nowrap; }
.gallery-project-grid { columns: 3; }
.gallery-project-grid .gallery-tile-video img { object-fit: contain; }
.gallery-project-grid .gallery-tile-video .gallery-caption { padding: 14px; }
@media (max-width: 1000px) { .gallery-project-grid { columns: 2; } }
@media (max-width: 500px) { .gallery-project-grid { columns: 1; } .gallery-project-grid .gallery-tile { max-height: 440px; } .gallery-project-grid .gallery-photo-title { font-size: 14px; } }

/* Compact preview with optional project grouping. */
.gallery-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 16px; }
.gallery-controls .gallery-filters { margin-bottom: 0; }
.gallery-group-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-secondary); font: 500 14px var(--font-sans); min-height: 44px; }
.gallery-group-toggle input { width: 18px; height: 18px; accent-color: var(--ros-blue); cursor: pointer; }
.gallery-order { color: var(--text-muted); font: 12px var(--font-mono); margin-bottom: 24px; }
.gallery-more { display: grid; justify-items: center; gap: 14px; margin-top: 28px; }
.gallery-more p { color: var(--text-muted); font: 13px var(--font-mono); }
.gallery-more-button { padding: 12px 28px; border: 1px solid var(--ros-blue); border-radius: 999px; background: transparent; color: var(--ros-blue); font: 500 14px var(--font-sans); cursor: pointer; }
.gallery-more-button:hover { background: var(--ros-blue); color: var(--primary-black); }
.gallery-more-button[hidden] { display: none; }
.gallery-more-button:focus-visible, .gallery-group-toggle input:focus-visible { outline: 3px solid var(--ros-blue); outline-offset: 4px; }
#galleryTitle { scroll-margin-top: 100px; }

.gallery-groups[data-expanded="false"] .gallery-tile { max-height: 280px; }
